Change in openvpn[master]: Add an optional username-only flag for auth-user-pass
A message that is not in the archive (sent off-list or not yet received): gerrit.1771470576000.I788f76e6a70a9c20bca3367140d2741bd0551582@...2715...
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email
to review the following change.
Change subject: Add an optional username-only flag for auth-user-pass
......................................................................
Add an optional username-only flag for auth-user-pass
Specify "--auth-user-pass username-only" for openvpn to prompt for only username, not password. Prompt via management interface uses the usual ">PASSWORD 'Auth' " prompt with type "username" instead of "username/password".
Internally, the password gets set as "[[BLANK]]" which is currently used as tag for blank password.
Not compatible with --static-challenge or when username and password are inlined or read from a file. In such cases, the user hard-code a dummy password in the file instead.
---
M doc/man-sections/client-options.rst
M doc/management-notes.txt
M src/openvpn/init.c
M src/openvpn/manage.c
M src/openvpn/manage.h
M src/openvpn/misc.c
M src/openvpn/misc.h
M src/openvpn/options.c
M src/openvpn/options.h
M src/openvpn/ssl.c
M src/openvpn/ssl.h
M src/openvpn/ssl_common.h
12 files changed, 82 insertions(+), 14 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/48/1548/1
doc/man-sections/client-options.rst +11 -1
@@ -68,7 +68,9 @@ auth-user-pass up If ``up`` is present, it must be a file containing username/password on 2 - lines. If the password line is missing, OpenVPN will prompt for one. + lines or a flag named :code:`username-only` to indicate no password + should be prompted for. In the former case, if the password line is missing + in the file, OpenVPN will prompt for one. If ``up`` is omitted, username/password will be prompted from the console.
@@ -84,6 +86,14 @@ where password is optional, and will be prompted from the console if missing. + The :code:`username-only` flag is meant to be used with SSO authentication + and is incompatible with the ``--static-challenge`` option and legacy + ``dynamic challenge`` protocol. When no password is requested from the user, + a dummy password :code:`[[BLANK]]` is generated internally and submitted to + the server. See management-notes.txt for how this option affects username/password + prompt via the management interface. For the console, it simply eliminates + the password prompt. + The server configuration must specify an ``--auth-user-pass-verify`` script to verify the username/password provided by the client.
doc/management-notes.txt +13 -0
@@ -304,6 +304,19 @@ username "Auth" foo password "Auth" bar + Example 3: + + >PASSWORD:Need 'Auth' username + + OpenVPN needs a --auth-user-pass username. The + management interface client should respond: + + username "Auth" foo + + In this case the user should not be prompted for a password. + Support for such username-only prompting is conditional on the + client announcing a version >= 3. + The username/password itself can be in quotes, and special characters such as double quote or backslash must be escaped, for example,
src/openvpn/init.c +3 -2
@@ -655,10 +655,10 @@enable_auth_user_pass ();#ifdef ENABLE_MANAGEMENT auth_user_pass_setup (c->options.auth_user_pass_file, c->options.auth_user_pass_file_inline, - &c->options.sc_info); + c->options.auth_user_pass_username_only, &c->options.sc_info);#else auth_user_pass_setup (c->options.auth_user_pass_file, c->options.auth_user_pass_file_inline, -NULL ); + c->options.auth_user_pass_username_only,NULL );#endif } }
@@ -3383,6 +3383,7 @@ } to.auth_user_pass_file = options->auth_user_pass_file; to.auth_user_pass_file_inline = options->auth_user_pass_file_inline; + to.auth_user_pass_username_only = options->auth_user_pass_username_only; to.auth_token_generate = options->auth_token_generate; to.auth_token_lifetime = options->auth_token_lifetime; to.auth_token_renewal = options->auth_token_renewal;
src/openvpn/manage.c +16 -4
@@ -58,9 +58,6 @@#define MANAGEMENT_ECHO_FLAGS 0#endif -/* tag for blank username/password */ -static const char blank_up[] ="[[BLANK]]" ; -struct management *management;/* GLOBAL */ /* static forward declarations */
@@ -729,6 +726,13 @@ {switch (man->connection.up_query_mode) { +case UP_QUERY_USERNAME : +if (strlen (man->connection.up_query.username)) + { + man->connection.up_query.defined = true; + } +break ; +case UP_QUERY_USER_PASS :if (!strlen (man->connection.up_query.username)) {
@@ -783,7 +787,9 @@ man_query_username(struct management *man, const char *type, const char *string) { const bool needed = - ((man->connection.up_query_mode ==UP_QUERY_USER_PASS ) && man->connection.up_query_type); + ((man->connection.up_query_mode ==UP_QUERY_USER_PASS + || man->connection.up_query_mode ==UP_QUERY_USERNAME ) + && man->connection.up_query_type);man_query_user_pass (man, type, string, needed,"username" , man->connection.up_query.username,USER_PASS_LEN ); }
@@ -3538,6 +3544,12 @@ prefix ="PASSWORD" ; alert_type ="password" ; } +else if ((man->connection.client_version >2 ) && (flags &GET_USER_PASS_USERNAME_ONLY )) + { + up_query_mode =UP_QUERY_USERNAME ; + prefix ="PASSWORD" ; + alert_type ="username" ; + }else { up_query_mode =UP_QUERY_USER_PASS ;
src/openvpn/manage.h +1 -0
@@ -264,6 +264,7 @@#define UP_QUERY_PASS 2#define UP_QUERY_NEED_OK 3#define UP_QUERY_NEED_STR 4 +#define UP_QUERY_USERNAME 5/* states */ #define MS_INITIAL 0/* all sockets are closed */
src/openvpn/misc.c +7 -1
@@ -216,6 +216,12 @@msg (M_WARN ,"Note: previous '%s' credentials failed" , prefix); } +/* Use tag for blank password if we are not prompting for one */ +if (flags &GET_USER_PASS_USERNAME_ONLY ) + { +strncpy (up->password, blank_up,sizeof (up->password)); + } +#ifdef ENABLE_MANAGEMENT /* * Get username/password from management interface?
@@ -389,7 +395,7 @@query_user_add (BSTR (&user_prompt), up->username,USER_PASS_LEN , true); } -if (password_from_stdin) +if (password_from_stdin && !(flags &GET_USER_PASS_USERNAME_ONLY )) {query_user_add (BSTR (&pass_prompt), up->password,USER_PASS_LEN , false); }
src/openvpn/misc.h +5 -0
@@ -48,6 +48,9 @@* Get and store a username/password */ +/* tag for blank username/password */ +static const char blank_up[] ="[[BLANK]]" ; +struct user_pass {bool defined;
@@ -123,6 +126,8 @@#define GET_USER_PASS_INLINE_CREDS (1 << 10)/** indicates password and response should be concatenated */ #define GET_USER_PASS_STATIC_CHALLENGE_CONCAT (1 << 11) +/** indicate that only username should be prompted for auth-user-pass */ +#define GET_USER_PASS_USERNAME_ONLY (1 << 12)/** * Retrieves the user credentials from various sources depending on the flags.
src/openvpn/options.c +13 -2
@@ -511,7 +511,8 @@" up is a file containing the username on the first line,\n" " and a password on the second. If either the password or both\n" " the username and the password are omitted OpenVPN will prompt\n" -" for them from console.\n" +" for them from console. If [up] is 'username-only', only username\n" +" will be prompted for from console or management interface.\n" "--pull : Accept certain config file options from the peer as if they\n" " were part of the local config file. Must be specified\n" " when connecting to a '--mode server' remote host.\n"
@@ -3925,6 +3926,10 @@ { o->auth_token_renewal = o->renegotiate_seconds; } +if (o->auth_user_pass_username_only && o->sc_info.challenge_text) + { +msg (M_USAGE ,"'auth-user-pass username-only' cannot be used with static challenge" ); + }pre_connect_save (o); }
@@ -7728,7 +7733,13 @@else if (streq (p[0 ],"auth-user-pass" ) && !p[2 ]) {VERIFY_PERMISSION (OPT_P_GENERAL |OPT_P_INLINE ); -if (p[1 ]) + options->auth_user_pass_username_only = false; +if (p[1 ] &&streq (p[1 ],"username-only" )) + { + options->auth_user_pass_username_only = true; + options->auth_user_pass_file ="stdin" ; + } +else if (p[1 ]) { options->auth_user_pass_file = p[1 ]; options->auth_user_pass_file_inline = is_inline;
src/openvpn/options.h +1 -0
@@ -558,6 +558,7 @@unsigned int push_update_options_found;/* tracks which option types have been reset in current PUSH_UPDATE sequence */ const char *auth_user_pass_file;bool auth_user_pass_file_inline; +bool auth_user_pass_username_only;struct options_pre_connect *pre_connect;int scheduled_exit_interval;
src/openvpn/ssl.c +10 -3
@@ -290,7 +290,8 @@ }void -auth_user_pass_setup (const char *auth_file,bool is_inline,const struct static_challenge_info *sci) +auth_user_pass_setup (const char *auth_file,bool is_inline,bool username_only, +const struct static_challenge_info *sci) {unsigned int flags =GET_USER_PASS_MANAGEMENT ;
@@ -298,6 +299,10 @@ { flags |=GET_USER_PASS_INLINE_CREDS ; } +if (username_only) + { + flags |=GET_USER_PASS_USERNAME_ONLY ; + }if (!auth_user_pass.defined && !auth_token.defined) {
@@ -2099,10 +2104,12 @@ {#ifdef ENABLE_MANAGEMENT auth_user_pass_setup (session->opt->auth_user_pass_file, - session->opt->auth_user_pass_file_inline, session->opt->sci); + session->opt->auth_user_pass_file_inline, + session->opt->auth_user_pass_username_only, session->opt->sci);#else auth_user_pass_setup (session->opt->auth_user_pass_file, - session->opt->auth_user_pass_file_inline,NULL ); + session->opt->auth_user_pass_file_inline, + session->opt->auth_user_pass_username_only,NULL );#endif struct user_pass *up = &auth_user_pass;
src/openvpn/ssl.h +1 -1
@@ -389,7 +389,7 @@* credentials stored in the file, however, if is_inline is true then auth_file * contains the username/password inline. */ -void auth_user_pass_setup (const char *auth_file,bool is_inline, +void auth_user_pass_setup (const char *auth_file,bool is_inline,bool username_only,const struct static_challenge_info *sc_info);/*
src/openvpn/ssl_common.h +1 -0
@@ -396,6 +396,7 @@const char *export_peer_cert_dir;const char *auth_user_pass_file;bool auth_user_pass_file_inline; +bool auth_user_pass_username_only;bool auth_token_generate;/**< Generate auth-tokens on successful * user/pass auth,seet via
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I788f76e6a70a9c20bca3367140d2741bd0551582
Gerrit-Change-Number: 1548
Gerrit-PatchSet: 1
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email
to look at the new patch set (#2).
Change subject: Add an optional username-only flag for auth-user-pass
......................................................................
Add an optional username-only flag for auth-user-pass
Specify "--auth-user-pass username-only" for openvpn to prompt for only username, not password. Prompt via management interface uses the usual ">PASSWORD 'Auth' " prompt with type "username" instead of "username/password".
Internally, the password gets set as "[[BLANK]]" which is currently used as tag for blank password.
Not compatible with --static-challenge or when username and password are inlined or read from a file. In such cases, the user hard-code a dummy password in the file instead.
---
M doc/man-sections/client-options.rst
M doc/management-notes.txt
M src/openvpn/init.c
M src/openvpn/manage.c
M src/openvpn/manage.h
M src/openvpn/misc.c
M src/openvpn/misc.h
M src/openvpn/options.c
M src/openvpn/options.h
M src/openvpn/ssl.c
M src/openvpn/ssl.h
M src/openvpn/ssl_common.h
12 files changed, 84 insertions(+), 14 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/48/1548/2
doc/man-sections/client-options.rst +11 -1
@@ -68,7 +68,9 @@ auth-user-pass up If ``up`` is present, it must be a file containing username/password on 2 - lines. If the password line is missing, OpenVPN will prompt for one. + lines or a flag named :code:`username-only` to indicate no password + should be prompted for. In the former case, if the password line is missing + in the file, OpenVPN will prompt for one. If ``up`` is omitted, username/password will be prompted from the console.
@@ -84,6 +86,14 @@ where password is optional, and will be prompted from the console if missing. + The :code:`username-only` flag is meant to be used with SSO authentication + and is incompatible with the ``--static-challenge`` option and legacy + ``dynamic challenge`` protocol. When no password is requested from the user, + a dummy password :code:`[[BLANK]]` is generated internally and submitted to + the server. See management-notes.txt for how this option affects username/password + prompt via the management interface. For the console, it simply eliminates + the password prompt. + The server configuration must specify an ``--auth-user-pass-verify`` script to verify the username/password provided by the client.
doc/management-notes.txt +13 -0
@@ -304,6 +304,19 @@ username "Auth" foo password "Auth" bar + Example 3: + + >PASSWORD:Need 'Auth' username + + OpenVPN needs a --auth-user-pass username. The + management interface client should respond: + + username "Auth" foo + + In this case the user should not be prompted for a password. + Support for such username-only prompting is conditional on the + client announcing a version >= 3. + The username/password itself can be in quotes, and special characters such as double quote or backslash must be escaped, for example,
src/openvpn/init.c +3 -2
@@ -655,10 +655,10 @@enable_auth_user_pass ();#ifdef ENABLE_MANAGEMENT auth_user_pass_setup (c->options.auth_user_pass_file, c->options.auth_user_pass_file_inline, - &c->options.sc_info); + c->options.auth_user_pass_username_only, &c->options.sc_info);#else auth_user_pass_setup (c->options.auth_user_pass_file, c->options.auth_user_pass_file_inline, -NULL ); + c->options.auth_user_pass_username_only,NULL );#endif } }
@@ -3376,6 +3376,7 @@ } to.auth_user_pass_file = options->auth_user_pass_file; to.auth_user_pass_file_inline = options->auth_user_pass_file_inline; + to.auth_user_pass_username_only = options->auth_user_pass_username_only; to.auth_token_generate = options->auth_token_generate; to.auth_token_lifetime = options->auth_token_lifetime; to.auth_token_renewal = options->auth_token_renewal;
src/openvpn/manage.c +16 -4
@@ -58,9 +58,6 @@#define MANAGEMENT_ECHO_FLAGS 0#endif -/* tag for blank username/password */ -static const char blank_up[] ="[[BLANK]]" ; -struct management *management;/* GLOBAL */ /* static forward declarations */
@@ -729,6 +726,13 @@ {switch (man->connection.up_query_mode) { +case UP_QUERY_USERNAME : +if (strlen (man->connection.up_query.username)) + { + man->connection.up_query.defined = true; + } +break ; +case UP_QUERY_USER_PASS :if (!strlen (man->connection.up_query.username)) {
@@ -783,7 +787,9 @@ man_query_username(struct management *man, const char *type, const char *string) { const bool needed = - ((man->connection.up_query_mode ==UP_QUERY_USER_PASS ) && man->connection.up_query_type); + ((man->connection.up_query_mode ==UP_QUERY_USER_PASS + || man->connection.up_query_mode ==UP_QUERY_USERNAME ) + && man->connection.up_query_type);man_query_user_pass (man, type, string, needed,"username" , man->connection.up_query.username,USER_PASS_LEN ); }
@@ -3538,6 +3544,12 @@ prefix ="PASSWORD" ; alert_type ="password" ; } +else if ((man->connection.client_version >2 ) && (flags &GET_USER_PASS_USERNAME_ONLY )) + { + up_query_mode =UP_QUERY_USERNAME ; + prefix ="PASSWORD" ; + alert_type ="username" ; + }else { up_query_mode =UP_QUERY_USER_PASS ;
src/openvpn/manage.h +1 -0
@@ -264,6 +264,7 @@#define UP_QUERY_PASS 2#define UP_QUERY_NEED_OK 3#define UP_QUERY_NEED_STR 4 +#define UP_QUERY_USERNAME 5/* states */ #define MS_INITIAL 0/* all sockets are closed */
src/openvpn/misc.c +7 -1
@@ -216,6 +216,12 @@msg (M_WARN ,"Note: previous '%s' credentials failed" , prefix); } +/* Use tag for blank password if we are not prompting for one */ +if (flags &GET_USER_PASS_USERNAME_ONLY ) + { +strncpy (up->password, blank_up,sizeof (up->password)); + } +#ifdef ENABLE_MANAGEMENT /* * Get username/password from management interface?
@@ -389,7 +395,7 @@query_user_add (BSTR (&user_prompt), up->username,USER_PASS_LEN , true); } -if (password_from_stdin) +if (password_from_stdin && !(flags &GET_USER_PASS_USERNAME_ONLY )) {query_user_add (BSTR (&pass_prompt), up->password,USER_PASS_LEN , false); }
src/openvpn/misc.h +5 -0
@@ -48,6 +48,9 @@* Get and store a username/password */ +/* tag for blank username/password */ +static const char blank_up[] ="[[BLANK]]" ; +struct user_pass {bool defined;
@@ -123,6 +126,8 @@#define GET_USER_PASS_INLINE_CREDS (1 << 10)/** indicates password and response should be concatenated */ #define GET_USER_PASS_STATIC_CHALLENGE_CONCAT (1 << 11) +/** indicate that only username should be prompted for auth-user-pass */ +#define GET_USER_PASS_USERNAME_ONLY (1 << 12)/** * Retrieves the user credentials from various sources depending on the flags.
src/openvpn/options.c +15 -2
@@ -510,7 +510,8 @@" up is a file containing the username on the first line,\n" " and a password on the second. If either the password or both\n" " the username and the password are omitted OpenVPN will prompt\n" -" for them from console.\n" +" for them from console. If [up] is 'username-only', only username\n" +" will be prompted for from console or management interface.\n" "--pull : Accept certain config file options from the peer as if they\n" " were part of the local config file. Must be specified\n" " when connecting to a '--mode server' remote host.\n"
@@ -3914,6 +3915,12 @@ { o->auth_token_renewal = o->renegotiate_seconds; } +#if ENABLE_MANAGEMENT +if (o->auth_user_pass_username_only && o->sc_info.challenge_text) + { +msg (M_USAGE ,"'auth-user-pass username-only' cannot be used with static challenge" ); + } +#endif pre_connect_save (o); }
@@ -7710,7 +7717,13 @@else if (streq (p[0 ],"auth-user-pass" ) && !p[2 ]) {VERIFY_PERMISSION (OPT_P_GENERAL |OPT_P_INLINE ); -if (p[1 ]) + options->auth_user_pass_username_only = false; +if (p[1 ] &&streq (p[1 ],"username-only" )) + { + options->auth_user_pass_username_only = true; + options->auth_user_pass_file ="stdin" ; + } +else if (p[1 ]) { options->auth_user_pass_file = p[1 ]; options->auth_user_pass_file_inline = is_inline;
src/openvpn/options.h +1 -0
@@ -558,6 +558,7 @@unsigned int push_update_options_found;/* tracks which option types have been reset in current PUSH_UPDATE sequence */ const char *auth_user_pass_file;bool auth_user_pass_file_inline; +bool auth_user_pass_username_only;struct options_pre_connect *pre_connect;int scheduled_exit_interval;
src/openvpn/ssl.c +10 -3
@@ -290,7 +290,8 @@ }void -auth_user_pass_setup (const char *auth_file,bool is_inline,const struct static_challenge_info *sci) +auth_user_pass_setup (const char *auth_file,bool is_inline,bool username_only, +const struct static_challenge_info *sci) {unsigned int flags =GET_USER_PASS_MANAGEMENT ;
@@ -298,6 +299,10 @@ { flags |=GET_USER_PASS_INLINE_CREDS ; } +if (username_only) + { + flags |=GET_USER_PASS_USERNAME_ONLY ; + }if (!auth_user_pass.defined && !auth_token.defined) {
@@ -2099,10 +2104,12 @@ {#ifdef ENABLE_MANAGEMENT auth_user_pass_setup (session->opt->auth_user_pass_file, - session->opt->auth_user_pass_file_inline, session->opt->sci); + session->opt->auth_user_pass_file_inline, + session->opt->auth_user_pass_username_only, session->opt->sci);#else auth_user_pass_setup (session->opt->auth_user_pass_file, - session->opt->auth_user_pass_file_inline,NULL ); + session->opt->auth_user_pass_file_inline, + session->opt->auth_user_pass_username_only,NULL );#endif struct user_pass *up = &auth_user_pass;
src/openvpn/ssl.h +1 -1
@@ -389,7 +389,7 @@* credentials stored in the file, however, if is_inline is true then auth_file * contains the username/password inline. */ -void auth_user_pass_setup (const char *auth_file,bool is_inline, +void auth_user_pass_setup (const char *auth_file,bool is_inline,bool username_only,const struct static_challenge_info *sc_info);/*
src/openvpn/ssl_common.h +1 -0
@@ -396,6 +396,7 @@const char *export_peer_cert_dir;const char *auth_user_pass_file;bool auth_user_pass_file_inline; +bool auth_user_pass_username_only;bool auth_token_generate;/**< Generate auth-tokens on successful * user/pass auth,seet via
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I788f76e6a70a9c20bca3367140d2741bd0551582
Gerrit-Change-Number: 1548
Gerrit-PatchSet: 2
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Attention is currently required from: plaisthos.
selvanair has posted comments on this change by selvanair. ( http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email )
Change subject: Add an optional username-only flag for auth-user-pass
......................................................................
Patch Set 2:
(2 comments)
Patchset:
PS2:
Are these build failures real? I guess VPN access is needed to access logs which I don't have,
PS2:
Any idea why some checks fail and how to see those error logs? I guess VPN access is needed to see the logs, but not sure how.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I788f76e6a70a9c20bca3367140d2741bd0551582
Gerrit-Change-Number: 1548
Gerrit-PatchSet: 2
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Mon, 23 Feb 2026 02:57:22 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Attention is currently required from: plaisthos, selvanair.
cron2 has posted comments on this change by selvanair. ( http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email )
Change subject: Add an optional username-only flag for auth-user-pass
......................................................................
Patch Set 2:
(1 comment)
Patchset:
PS2:
Quoted 1 line
Any idea why some checks fail and how to see those error logs? I guess VPN access is needed to see t […]
All the arch-* had failures due to "const" warnings/errors with most recent glibc. Those are fixed in master now.
I have restarted the failed builds - if they still fail, please rebase to master and send a v3, this should fix things.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I788f76e6a70a9c20bca3367140d2741bd0551582
Gerrit-Change-Number: 1548
Gerrit-PatchSet: 2
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: selvanair <[email protected]...>
Gerrit-Comment-Date: Mon, 23 Feb 2026 07:10:00 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: selvanair <[email protected]...>
Attention is currently required from: plaisthos, selvanair.
flichtenheld has posted comments on this change by selvanair. ( http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email )
Change subject: Add an optional username-only flag for auth-user-pass
......................................................................
Patch Set 2:
(1 comment)
Patchset:
PS2:
Quoted 1 line
Are these build failures real? I guess VPN access is needed to access logs which I don't have,
They should be fixed in latest master, just rebase, please.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I788f76e6a70a9c20bca3367140d2741bd0551582
Gerrit-Change-Number: 1548
Gerrit-PatchSet: 2
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: selvanair <[email protected]...>
Gerrit-Comment-Date: Mon, 23 Feb 2026 10:31:21 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: selvanair <[email protected]...>
Attention is currently required from: flichtenheld, plaisthos.
selvanair has posted comments on this change by selvanair. ( http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email )
Change subject: Add an optional username-only flag for auth-user-pass
......................................................................
Patch Set 3:
(1 comment)
Patchset:
PS2:
Quoted 1 line
They should be fixed in latest master, just rebase, please.
Done
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I788f76e6a70a9c20bca3367140d2741bd0551582
Gerrit-Change-Number: 1548
Gerrit-PatchSet: 3
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Mon, 23 Feb 2026 22:39:26 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]...>
Comment-In-Reply-To: selvanair <[email protected]...>
Attention is currently required from: flichtenheld, plaisthos.
Hello plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email
to look at the new patch set (#4).
Change subject: Add an optional username-only flag for auth-user-pass
......................................................................
Add an optional username-only flag for auth-user-pass
Specify "--auth-user-pass username-only" for openvpn to prompt for only username, not password. Prompt via management interface uses the usual ">PASSWORD 'Auth' " prompt with type "username" instead of "username/password".
Internally, the password gets set as "[[BLANK]]" which is currently used as tag for blank password.
Not compatible with --static-challenge or when username and password are inlined or read from a file. In such cases, the user hard-code a dummy password in the file instead.
---
M doc/man-sections/client-options.rst
M doc/management-notes.txt
M src/openvpn/init.c
M src/openvpn/manage.c
M src/openvpn/manage.h
M src/openvpn/misc.c
M src/openvpn/misc.h
M src/openvpn/options.c
M src/openvpn/options.h
M src/openvpn/ssl.c
M src/openvpn/ssl.h
M src/openvpn/ssl_common.h
12 files changed, 84 insertions(+), 14 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/48/1548/4
doc/man-sections/client-options.rst +11 -1
@@ -68,7 +68,9 @@ auth-user-pass up If ``up`` is present, it must be a file containing username/password on 2 - lines. If the password line is missing, OpenVPN will prompt for one. + lines or a flag named :code:`username-only` to indicate no password + should be prompted for. In the former case, if the password line is missing + in the file, OpenVPN will prompt for one. If ``up`` is omitted, username/password will be prompted from the console.
@@ -84,6 +86,14 @@ where password is optional, and will be prompted from the console if missing. + The :code:`username-only` flag is meant to be used with SSO authentication + and is incompatible with the ``--static-challenge`` option and legacy + ``dynamic challenge`` protocol. When no password is requested from the user, + a dummy password :code:`[[BLANK]]` is generated internally and submitted to + the server. See management-notes.txt for how this option affects username/password + prompt via the management interface. For the console, it simply eliminates + the password prompt. + The server configuration must specify an ``--auth-user-pass-verify`` script to verify the username/password provided by the client.
doc/management-notes.txt +13 -0
@@ -304,6 +304,19 @@ username "Auth" foo password "Auth" bar + Example 3: + + >PASSWORD:Need 'Auth' username + + OpenVPN needs a --auth-user-pass username. The + management interface client should respond: + + username "Auth" foo + + In this case the user should not be prompted for a password. + Support for such username-only prompting is conditional on the + client announcing a version >= 4. + The username/password itself can be in quotes, and special characters such as double quote or backslash must be escaped, for example,
src/openvpn/init.c +3 -2
@@ -655,10 +655,10 @@enable_auth_user_pass ();#ifdef ENABLE_MANAGEMENT auth_user_pass_setup (c->options.auth_user_pass_file, c->options.auth_user_pass_file_inline, - &c->options.sc_info); + c->options.auth_user_pass_username_only, &c->options.sc_info);#else auth_user_pass_setup (c->options.auth_user_pass_file, c->options.auth_user_pass_file_inline, -NULL ); + c->options.auth_user_pass_username_only,NULL );#endif } }
@@ -3376,6 +3376,7 @@ } to.auth_user_pass_file = options->auth_user_pass_file; to.auth_user_pass_file_inline = options->auth_user_pass_file_inline; + to.auth_user_pass_username_only = options->auth_user_pass_username_only; to.auth_token_generate = options->auth_token_generate; to.auth_token_lifetime = options->auth_token_lifetime; to.auth_token_renewal = options->auth_token_renewal;
src/openvpn/manage.c +16 -4
@@ -58,9 +58,6 @@#define MANAGEMENT_ECHO_FLAGS 0#endif -/* tag for blank username/password */ -static const char blank_up[] ="[[BLANK]]" ; -struct management *management;/* GLOBAL */ /* static forward declarations */
@@ -729,6 +726,13 @@ {switch (man->connection.up_query_mode) { +case UP_QUERY_USERNAME : +if (strlen (man->connection.up_query.username)) + { + man->connection.up_query.defined = true; + } +break ; +case UP_QUERY_USER_PASS :if (!strlen (man->connection.up_query.username)) {
@@ -783,7 +787,9 @@ man_query_username(struct management *man, const char *type, const char *string) { const bool needed = - ((man->connection.up_query_mode ==UP_QUERY_USER_PASS ) && man->connection.up_query_type); + ((man->connection.up_query_mode ==UP_QUERY_USER_PASS + || man->connection.up_query_mode ==UP_QUERY_USERNAME ) + && man->connection.up_query_type);man_query_user_pass (man, type, string, needed,"username" , man->connection.up_query.username,USER_PASS_LEN ); }
@@ -3538,6 +3544,12 @@ prefix ="PASSWORD" ; alert_type ="password" ; } +else if ((man->connection.client_version >=4 ) && (flags &GET_USER_PASS_USERNAME_ONLY )) + { + up_query_mode =UP_QUERY_USERNAME ; + prefix ="PASSWORD" ; + alert_type ="username" ; + }else { up_query_mode =UP_QUERY_USER_PASS ;
src/openvpn/manage.h +1 -0
@@ -264,6 +264,7 @@#define UP_QUERY_PASS 2#define UP_QUERY_NEED_OK 3#define UP_QUERY_NEED_STR 4 +#define UP_QUERY_USERNAME 5/* states */ #define MS_INITIAL 0/* all sockets are closed */
src/openvpn/misc.c +7 -1
@@ -216,6 +216,12 @@msg (M_WARN ,"Note: previous '%s' credentials failed" , prefix); } +/* Use tag for blank password if we are not prompting for one */ +if (flags &GET_USER_PASS_USERNAME_ONLY ) + { +strncpy (up->password, blank_up,sizeof (up->password)); + } +#ifdef ENABLE_MANAGEMENT /* * Get username/password from management interface?
@@ -389,7 +395,7 @@query_user_add (BSTR (&user_prompt), up->username,USER_PASS_LEN , true); } -if (password_from_stdin) +if (password_from_stdin && !(flags &GET_USER_PASS_USERNAME_ONLY )) {query_user_add (BSTR (&pass_prompt), up->password,USER_PASS_LEN , false); }
src/openvpn/misc.h +5 -0
@@ -48,6 +48,9 @@* Get and store a username/password */ +/* tag for blank username/password */ +static const char blank_up[] ="[[BLANK]]" ; +struct user_pass {bool defined;
@@ -123,6 +126,8 @@#define GET_USER_PASS_INLINE_CREDS (1 << 10)/** indicates password and response should be concatenated */ #define GET_USER_PASS_STATIC_CHALLENGE_CONCAT (1 << 11) +/** indicate that only username should be prompted for auth-user-pass */ +#define GET_USER_PASS_USERNAME_ONLY (1 << 12)/** * Retrieves the user credentials from various sources depending on the flags.
src/openvpn/options.c +15 -2
@@ -510,7 +510,8 @@" up is a file containing the username on the first line,\n" " and a password on the second. If either the password or both\n" " the username and the password are omitted OpenVPN will prompt\n" -" for them from console.\n" +" for them from console. If [up] is 'username-only', only username\n" +" will be prompted for from console or management interface.\n" "--pull : Accept certain config file options from the peer as if they\n" " were part of the local config file. Must be specified\n" " when connecting to a '--mode server' remote host.\n"
@@ -3914,6 +3915,12 @@ { o->auth_token_renewal = o->renegotiate_seconds; } +#if ENABLE_MANAGEMENT +if (o->auth_user_pass_username_only && o->sc_info.challenge_text) + { +msg (M_USAGE ,"'auth-user-pass username-only' cannot be used with static challenge" ); + } +#endif pre_connect_save (o); }
@@ -7710,7 +7717,13 @@else if (streq (p[0 ],"auth-user-pass" ) && !p[2 ]) {VERIFY_PERMISSION (OPT_P_GENERAL |OPT_P_INLINE ); -if (p[1 ]) + options->auth_user_pass_username_only = false; +if (p[1 ] &&streq (p[1 ],"username-only" )) + { + options->auth_user_pass_username_only = true; + options->auth_user_pass_file ="stdin" ; + } +else if (p[1 ]) { options->auth_user_pass_file = p[1 ]; options->auth_user_pass_file_inline = is_inline;
src/openvpn/options.h +1 -0
@@ -558,6 +558,7 @@unsigned int push_update_options_found;/* tracks which option types have been reset in current PUSH_UPDATE sequence */ const char *auth_user_pass_file;bool auth_user_pass_file_inline; +bool auth_user_pass_username_only;struct options_pre_connect *pre_connect;int scheduled_exit_interval;
src/openvpn/ssl.c +10 -3
@@ -290,7 +290,8 @@ }void -auth_user_pass_setup (const char *auth_file,bool is_inline,const struct static_challenge_info *sci) +auth_user_pass_setup (const char *auth_file,bool is_inline,bool username_only, +const struct static_challenge_info *sci) {unsigned int flags =GET_USER_PASS_MANAGEMENT ;
@@ -298,6 +299,10 @@ { flags |=GET_USER_PASS_INLINE_CREDS ; } +if (username_only) + { + flags |=GET_USER_PASS_USERNAME_ONLY ; + }if (!auth_user_pass.defined && !auth_token.defined) {
@@ -2099,10 +2104,12 @@ {#ifdef ENABLE_MANAGEMENT auth_user_pass_setup (session->opt->auth_user_pass_file, - session->opt->auth_user_pass_file_inline, session->opt->sci); + session->opt->auth_user_pass_file_inline, + session->opt->auth_user_pass_username_only, session->opt->sci);#else auth_user_pass_setup (session->opt->auth_user_pass_file, - session->opt->auth_user_pass_file_inline,NULL ); + session->opt->auth_user_pass_file_inline, + session->opt->auth_user_pass_username_only,NULL );#endif struct user_pass *up = &auth_user_pass;
src/openvpn/ssl.h +1 -1
@@ -389,7 +389,7 @@* credentials stored in the file, however, if is_inline is true then auth_file * contains the username/password inline. */ -void auth_user_pass_setup (const char *auth_file,bool is_inline, +void auth_user_pass_setup (const char *auth_file,bool is_inline,bool username_only,const struct static_challenge_info *sc_info);/*
src/openvpn/ssl_common.h +1 -0
@@ -396,6 +396,7 @@const char *export_peer_cert_dir;const char *auth_user_pass_file;bool auth_user_pass_file_inline; +bool auth_user_pass_username_only;bool auth_token_generate;/**< Generate auth-tokens on successful * user/pass auth,seet via
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I788f76e6a70a9c20bca3367140d2741bd0551582
Gerrit-Change-Number: 1548
Gerrit-PatchSet: 4
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Attention is currently required from: flichtenheld, selvanair.
plaisthos has posted comments on this change by selvanair. ( http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email )
Change subject: Add an optional username-only flag for auth-user-pass
......................................................................
Patch Set 4:
(1 comment)
Patchset:
PS4:
Note that OpenVPN3/OpenVPN Connect implments this in a completely wacky and undocument way: You need to have
# OVPN_ACCESS_SERVER_USERNAME=testa
in your ovpn config.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I788f76e6a70a9c20bca3367140d2741bd0551582
Gerrit-Change-Number: 1548
Gerrit-PatchSet: 4
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: selvanair <[email protected]...>
Gerrit-Comment-Date: Mon, 02 Mar 2026 14:22:13 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Attention is currently required from: flichtenheld, plaisthos.
selvanair has posted comments on this change by selvanair. ( http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email )
Change subject: Add an optional username-only flag for auth-user-pass
......................................................................
Patch Set 4:
(1 comment)
Patchset:
PS4:
Quoted 1 line
Note that OpenVPN3/OpenVPN Connect implments this in a completely wacky and undocument way: You need […]
Well, a review would be appreciated.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I788f76e6a70a9c20bca3367140d2741bd0551582
Gerrit-Change-Number: 1548
Gerrit-PatchSet: 4
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Mon, 02 Mar 2026 14:58:34 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: plaisthos <[email protected]...>
Attention is currently required from: flichtenheld, plaisthos.
plaisthos has posted comments on this change by selvanair. ( http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email )
Change subject: Add an optional username-only flag for auth-user-pass
......................................................................
Patch Set 4:
(2 comments)
Patchset:
PS4:
The patch overall looks good but think the usability how to use the feature needs to be clearer.
File doc/man-sections/client-options.rst:
http://gerrit.openvpn.net/c/openvpn/+/1548/comment/695f9498_3d55bfa1?usp=email :
PS4, Line 96:
So I have a bit of usability problems here. If I want to put the username to use into the profile, in typical OpenVPN fashion I expect to having to use
auth-user-pass username-only
<auth-user-pass>
theusername
</auth-user-pass>
which is not necessarily obvious. If we want this to be the way, we should at least document it.
And something like
auth-user-pass /some/file username-only does not seem to be supported.
auth-user-pass username-only
auth-user-pass /some/file username-only
might work but is not intuitive either.
Maybe have something like auth-sendusername as alias to auth-user-pass that imlicitlty sets the flag and otherwise works the same as auth-user-pass?
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I788f76e6a70a9c20bca3367140d2741bd0551582
Gerrit-Change-Number: 1548
Gerrit-PatchSet: 4
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Mon, 02 Mar 2026 15:03:45 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Attention is currently required from: flichtenheld, plaisthos.
selvanair has posted comments on this change by selvanair. ( http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email )
Change subject: Add an optional username-only flag for auth-user-pass
......................................................................
Patch Set 4:
(1 comment)
File doc/man-sections/client-options.rst:
http://gerrit.openvpn.net/c/openvpn/+/1548/comment/5b6d4fe6_304f5220?usp=email :
PS4, Line 96:
Quoted 1 line
So I have a bit of usability problems here. […]
Embedding username (with or without password) or reading from file are incompatible with username-only field. So, the usage you mentioned is not supported.
I thought this was obvious as we currently do not support repeating such options like auth-user-pass --- i.e when repeated, onlythe last one overwrites previous ones. But we can strss this as done in teh commit message.
If user wants to inline a username in the file, do not use username-only, just inline the username and a dummy password. Its already possible an dno chnages needed. Adding a dummy password inline is no trouble IMO.
The rationale: The only case where "username-only" is required and useful is when no password should be prompted for, and embedding a dummy password is not practical: as in common config files for all users and SSO based on username/email that we do in some environments.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I788f76e6a70a9c20bca3367140d2741bd0551582
Gerrit-Change-Number: 1548
Gerrit-PatchSet: 4
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Mon, 02 Mar 2026 15:19:33 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: plaisthos <[email protected]...>
Attention is currently required from: flichtenheld, selvanair.
plaisthos has posted comments on this change by selvanair. ( http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email )
Change subject: Add an optional username-only flag for auth-user-pass
......................................................................
Patch Set 4:
(2 comments)
Patchset:
PS4:
Quoted 1 line
Well, a review would be appreciated.
yeah that was just a side that I added to this while doing the review. The delayed response made this a bit weird.
File doc/man-sections/client-options.rst:
http://gerrit.openvpn.net/c/openvpn/+/1548/comment/bc07f8c6_a0153d37?usp=email :
PS4, Line 96:
Quoted 1 line
Embedding username (with or without password) or reading from file are incompatible with username-on […]
Yeah but I think it is good mention this then and more explicitly point this out.
[...] ``dynamic challenge`` protocol. In these cases the user will be asked for a username but not password. If embedding only username but no password in the configure is desired a dummy password like 'no_passsword_required' should be used instead.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I788f76e6a70a9c20bca3367140d2741bd0551582
Gerrit-Change-Number: 1548
Gerrit-PatchSet: 4
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: selvanair <[email protected]...>
Gerrit-Comment-Date: Mon, 02 Mar 2026 15:51:46 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: plaisthos <[email protected]...>
Comment-In-Reply-To: selvanair <[email protected]...>
Attention is currently required from: flichtenheld, selvanair.
Hello plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email
to look at the new patch set (#5).
Change subject: Add an optional username-only flag for auth-user-pass
......................................................................
Add an optional username-only flag for auth-user-pass
Specify "--auth-user-pass username-only" for openvpn to prompt for only username, not password. Prompt via management interface uses the usual ">PASSWORD 'Auth' " prompt with type "username" instead of "username/password".
Internally, the password gets set as "[[BLANK]]" which is currently used as tag for blank password.
Not compatible with --static-challenge or when username and password are inlined or read from a file. In such cases, the user hard-code a dummy password in the file instead.
---
M doc/man-sections/client-options.rst
M doc/management-notes.txt
M src/openvpn/init.c
M src/openvpn/manage.c
M src/openvpn/manage.h
M src/openvpn/misc.c
M src/openvpn/misc.h
M src/openvpn/options.c
M src/openvpn/options.h
M src/openvpn/ssl.c
M src/openvpn/ssl.h
M src/openvpn/ssl_common.h
12 files changed, 90 insertions(+), 14 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/48/1548/5
doc/man-sections/client-options.rst +17 -1
@@ -68,7 +68,9 @@ auth-user-pass up If ``up`` is present, it must be a file containing username/password on 2 - lines. If the password line is missing, OpenVPN will prompt for one. + lines or a flag named :code:`username-only` to indicate no password + should be prompted for. In the former case, if the password line is missing + in the file, OpenVPN will prompt for one. If ``up`` is omitted, username/password will be prompted from the console.
@@ -84,6 +86,20 @@ where password is optional, and will be prompted from the console if missing. + The :code:`username-only` flag is meant to be used with SSO authentication. + In this case the user will be asked for a username but not password. Instead, + a dummy password :code:`[[BLANK]]` is generated internally and submitted to + the server. See management-notes.txt for how this option affects username/password + prompt via the management interface. For the console, it simply eliminates + the password prompt. + + The :code:`username-only` flag cannot be used along with embedding username and + or password in the conifg file, or while reading them from an external file. In + such cases, if only username is relevant and no password prompt is desired, a + dummy password like 'no_passsword' should be embedded as well. This flag is also + incompatible with the ``--static-challenge`` option and legacy ``dynamic challenge`` + protocol. + The server configuration must specify an ``--auth-user-pass-verify`` script to verify the username/password provided by the client.
doc/management-notes.txt +13 -0
@@ -304,6 +304,19 @@ username "Auth" foo password "Auth" bar + Example 3: + + >PASSWORD:Need 'Auth' username + + OpenVPN needs a --auth-user-pass username. The + management interface client should respond: + + username "Auth" foo + + In this case the user should not be prompted for a password. + Support for such username-only prompting is conditional on the + client announcing a version >= 4. + The username/password itself can be in quotes, and special characters such as double quote or backslash must be escaped, for example,
src/openvpn/init.c +3 -2
@@ -655,10 +655,10 @@enable_auth_user_pass ();#ifdef ENABLE_MANAGEMENT auth_user_pass_setup (c->options.auth_user_pass_file, c->options.auth_user_pass_file_inline, - &c->options.sc_info); + c->options.auth_user_pass_username_only, &c->options.sc_info);#else auth_user_pass_setup (c->options.auth_user_pass_file, c->options.auth_user_pass_file_inline, -NULL ); + c->options.auth_user_pass_username_only,NULL );#endif } }
@@ -3376,6 +3376,7 @@ } to.auth_user_pass_file = options->auth_user_pass_file; to.auth_user_pass_file_inline = options->auth_user_pass_file_inline; + to.auth_user_pass_username_only = options->auth_user_pass_username_only; to.auth_token_generate = options->auth_token_generate; to.auth_token_lifetime = options->auth_token_lifetime; to.auth_token_renewal = options->auth_token_renewal;
src/openvpn/manage.c +16 -4
@@ -58,9 +58,6 @@#define MANAGEMENT_ECHO_FLAGS 0#endif -/* tag for blank username/password */ -static const char blank_up[] ="[[BLANK]]" ; -struct management *management;/* GLOBAL */ /* static forward declarations */
@@ -729,6 +726,13 @@ {switch (man->connection.up_query_mode) { +case UP_QUERY_USERNAME : +if (strlen (man->connection.up_query.username)) + { + man->connection.up_query.defined = true; + } +break ; +case UP_QUERY_USER_PASS :if (!strlen (man->connection.up_query.username)) {
@@ -783,7 +787,9 @@ man_query_username(struct management *man, const char *type, const char *string) { const bool needed = - ((man->connection.up_query_mode ==UP_QUERY_USER_PASS ) && man->connection.up_query_type); + ((man->connection.up_query_mode ==UP_QUERY_USER_PASS + || man->connection.up_query_mode ==UP_QUERY_USERNAME ) + && man->connection.up_query_type);man_query_user_pass (man, type, string, needed,"username" , man->connection.up_query.username,USER_PASS_LEN ); }
@@ -3538,6 +3544,12 @@ prefix ="PASSWORD" ; alert_type ="password" ; } +else if ((man->connection.client_version >=4 ) && (flags &GET_USER_PASS_USERNAME_ONLY )) + { + up_query_mode =UP_QUERY_USERNAME ; + prefix ="PASSWORD" ; + alert_type ="username" ; + }else { up_query_mode =UP_QUERY_USER_PASS ;
src/openvpn/manage.h +1 -0
@@ -264,6 +264,7 @@#define UP_QUERY_PASS 2#define UP_QUERY_NEED_OK 3#define UP_QUERY_NEED_STR 4 +#define UP_QUERY_USERNAME 5/* states */ #define MS_INITIAL 0/* all sockets are closed */
src/openvpn/misc.c +7 -1
@@ -216,6 +216,12 @@msg (M_WARN ,"Note: previous '%s' credentials failed" , prefix); } +/* Use tag for blank password if we are not prompting for one */ +if (flags &GET_USER_PASS_USERNAME_ONLY ) + { +strncpy (up->password, blank_up,sizeof (up->password)); + } +#ifdef ENABLE_MANAGEMENT /* * Get username/password from management interface?
@@ -389,7 +395,7 @@query_user_add (BSTR (&user_prompt), up->username,USER_PASS_LEN , true); } -if (password_from_stdin) +if (password_from_stdin && !(flags &GET_USER_PASS_USERNAME_ONLY )) {query_user_add (BSTR (&pass_prompt), up->password,USER_PASS_LEN , false); }
src/openvpn/misc.h +5 -0
@@ -48,6 +48,9 @@* Get and store a username/password */ +/* tag for blank username/password */ +static const char blank_up[] ="[[BLANK]]" ; +struct user_pass {bool defined;
@@ -123,6 +126,8 @@#define GET_USER_PASS_INLINE_CREDS (1 << 10)/** indicates password and response should be concatenated */ #define GET_USER_PASS_STATIC_CHALLENGE_CONCAT (1 << 11) +/** indicate that only username should be prompted for auth-user-pass */ +#define GET_USER_PASS_USERNAME_ONLY (1 << 12)/** * Retrieves the user credentials from various sources depending on the flags.
src/openvpn/options.c +15 -2
@@ -510,7 +510,8 @@" up is a file containing the username on the first line,\n" " and a password on the second. If either the password or both\n" " the username and the password are omitted OpenVPN will prompt\n" -" for them from console.\n" +" for them from console. If [up] is 'username-only', only username\n" +" will be prompted for from console or management interface.\n" "--pull : Accept certain config file options from the peer as if they\n" " were part of the local config file. Must be specified\n" " when connecting to a '--mode server' remote host.\n"
@@ -3914,6 +3915,12 @@ { o->auth_token_renewal = o->renegotiate_seconds; } +#if ENABLE_MANAGEMENT +if (o->auth_user_pass_username_only && o->sc_info.challenge_text) + { +msg (M_USAGE ,"'auth-user-pass username-only' cannot be used with static challenge" ); + } +#endif pre_connect_save (o); }
@@ -7710,7 +7717,13 @@else if (streq (p[0 ],"auth-user-pass" ) && !p[2 ]) {VERIFY_PERMISSION (OPT_P_GENERAL |OPT_P_INLINE ); -if (p[1 ]) + options->auth_user_pass_username_only = false; +if (p[1 ] &&streq (p[1 ],"username-only" )) + { + options->auth_user_pass_username_only = true; + options->auth_user_pass_file ="stdin" ; + } +else if (p[1 ]) { options->auth_user_pass_file = p[1 ]; options->auth_user_pass_file_inline = is_inline;
src/openvpn/options.h +1 -0
@@ -558,6 +558,7 @@unsigned int push_update_options_found;/* tracks which option types have been reset in current PUSH_UPDATE sequence */ const char *auth_user_pass_file;bool auth_user_pass_file_inline; +bool auth_user_pass_username_only;struct options_pre_connect *pre_connect;int scheduled_exit_interval;
src/openvpn/ssl.c +10 -3
@@ -290,7 +290,8 @@ }void -auth_user_pass_setup (const char *auth_file,bool is_inline,const struct static_challenge_info *sci) +auth_user_pass_setup (const char *auth_file,bool is_inline,bool username_only, +const struct static_challenge_info *sci) {unsigned int flags =GET_USER_PASS_MANAGEMENT ;
@@ -298,6 +299,10 @@ { flags |=GET_USER_PASS_INLINE_CREDS ; } +if (username_only) + { + flags |=GET_USER_PASS_USERNAME_ONLY ; + }if (!auth_user_pass.defined && !auth_token.defined) {
@@ -2099,10 +2104,12 @@ {#ifdef ENABLE_MANAGEMENT auth_user_pass_setup (session->opt->auth_user_pass_file, - session->opt->auth_user_pass_file_inline, session->opt->sci); + session->opt->auth_user_pass_file_inline, + session->opt->auth_user_pass_username_only, session->opt->sci);#else auth_user_pass_setup (session->opt->auth_user_pass_file, - session->opt->auth_user_pass_file_inline,NULL ); + session->opt->auth_user_pass_file_inline, + session->opt->auth_user_pass_username_only,NULL );#endif struct user_pass *up = &auth_user_pass;
src/openvpn/ssl.h +1 -1
@@ -389,7 +389,7 @@* credentials stored in the file, however, if is_inline is true then auth_file * contains the username/password inline. */ -void auth_user_pass_setup (const char *auth_file,bool is_inline, +void auth_user_pass_setup (const char *auth_file,bool is_inline,bool username_only,const struct static_challenge_info *sc_info);/*
src/openvpn/ssl_common.h +1 -0
@@ -396,6 +396,7 @@const char *export_peer_cert_dir;const char *auth_user_pass_file;bool auth_user_pass_file_inline; +bool auth_user_pass_username_only;bool auth_token_generate;/**< Generate auth-tokens on successful * user/pass auth,seet via
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I788f76e6a70a9c20bca3367140d2741bd0551582
Gerrit-Change-Number: 1548
Gerrit-PatchSet: 5
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: selvanair <[email protected]...>
Attention is currently required from: flichtenheld, plaisthos.
selvanair has posted comments on this change by selvanair. ( http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email )
Change subject: Add an optional username-only flag for auth-user-pass
......................................................................
Patch Set 4:
(1 comment)
File doc/man-sections/client-options.rst:
http://gerrit.openvpn.net/c/openvpn/+/1548/comment/8ce49b8b_ab994a1a?usp=email :
PS4, Line 96:
Quoted 1 line
Yeah but I think it is good mention this then and more explicitly point this out. […]
Done
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I788f76e6a70a9c20bca3367140d2741bd0551582
Gerrit-Change-Number: 1548
Gerrit-PatchSet: 4
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Mon, 02 Mar 2026 18:10:42 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: plaisthos <[email protected]...>
Comment-In-Reply-To: selvanair <[email protected]...>
Attention is currently required from: flichtenheld, selvanair.
plaisthos has posted comments on this change by selvanair. ( http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email )
Change subject: Add an optional username-only flag for auth-user-pass
......................................................................
Patch Set 5: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I788f76e6a70a9c20bca3367140d2741bd0551582
Gerrit-Change-Number: 1548
Gerrit-PatchSet: 5
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: selvanair <[email protected]...>
Gerrit-Comment-Date: Mon, 02 Mar 2026 19:55:48 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Attention is currently required from: flichtenheld, selvanair.
plaisthos has posted comments on this change by selvanair. ( http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email )
Change subject: Add an optional username-only flag for auth-user-pass
......................................................................
Patch Set 5:
(1 comment)
File doc/man-sections/client-options.rst:
http://gerrit.openvpn.net/c/openvpn/+/1548/comment/28ff3199_39d31afe?usp=email :
PS5, Line 97: or password in the conifg file, or while reading them from an external file. In
typo in conifg file. Either change on commit or have a quick revision here.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I788f76e6a70a9c20bca3367140d2741bd0551582
Gerrit-Change-Number: 1548
Gerrit-PatchSet: 5
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: selvanair <[email protected]...>
Gerrit-Comment-Date: Mon, 02 Mar 2026 19:56:44 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Attention is currently required from: flichtenheld, plaisthos, selvanair.
Hello plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email
to look at the new patch set (#6).
The following approvals got outdated and were removed:
Code-Review+2 by plaisthos
The change is no longer submittable: Code-Review and checks~ChecksSubmitRule are unsatisfied now.
Change subject: Add an optional username-only flag for auth-user-pass
......................................................................
Add an optional username-only flag for auth-user-pass
Specify "--auth-user-pass username-only" for openvpn to prompt for only username, not password. Prompt via management interface uses the usual ">PASSWORD 'Auth' " prompt with type "username" instead of "username/password".
Internally, the password gets set as "[[BLANK]]" which is currently used as tag for blank password.
Not compatible with --static-challenge or when username and password are inlined or read from a file. In such cases, the user hard-code a dummy password in the file instead.
---
M doc/man-sections/client-options.rst
M doc/management-notes.txt
M src/openvpn/init.c
M src/openvpn/manage.c
M src/openvpn/manage.h
M src/openvpn/misc.c
M src/openvpn/misc.h
M src/openvpn/options.c
M src/openvpn/options.h
M src/openvpn/ssl.c
M src/openvpn/ssl.h
M src/openvpn/ssl_common.h
12 files changed, 90 insertions(+), 14 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/48/1548/6
doc/man-sections/client-options.rst +17 -1
@@ -68,7 +68,9 @@ auth-user-pass up If ``up`` is present, it must be a file containing username/password on 2 - lines. If the password line is missing, OpenVPN will prompt for one. + lines or a flag named :code:`username-only` to indicate no password + should be prompted for. In the former case, if the password line is missing + in the file, OpenVPN will prompt for one. If ``up`` is omitted, username/password will be prompted from the console.
@@ -84,6 +86,20 @@ where password is optional, and will be prompted from the console if missing. + The :code:`username-only` flag is meant to be used with SSO authentication. + In this case the user will be asked for a username but not password. Instead, + a dummy password :code:`[[BLANK]]` is generated internally and submitted to + the server. See management-notes.txt for how this option affects username/password + prompt via the management interface. For the console, it simply eliminates + the password prompt. + + The :code:`username-only` flag cannot be used along with embedding username and/or + password in the config file, or while reading them from an external file. In + such cases, if only username is relevant and no password prompt is desired, a + dummy password like 'no_passsword' should be embedded as well. This flag is also + incompatible with the ``--static-challenge`` option and legacy ``dynamic challenge`` + protocol. + The server configuration must specify an ``--auth-user-pass-verify`` script to verify the username/password provided by the client.
doc/management-notes.txt +13 -0
@@ -304,6 +304,19 @@ username "Auth" foo password "Auth" bar + Example 3: + + >PASSWORD:Need 'Auth' username + + OpenVPN needs a --auth-user-pass username. The + management interface client should respond: + + username "Auth" foo + + In this case the user should not be prompted for a password. + Support for such username-only prompting is conditional on the + client announcing a version >= 4. + The username/password itself can be in quotes, and special characters such as double quote or backslash must be escaped, for example,
src/openvpn/init.c +3 -2
@@ -655,10 +655,10 @@enable_auth_user_pass ();#ifdef ENABLE_MANAGEMENT auth_user_pass_setup (c->options.auth_user_pass_file, c->options.auth_user_pass_file_inline, - &c->options.sc_info); + c->options.auth_user_pass_username_only, &c->options.sc_info);#else auth_user_pass_setup (c->options.auth_user_pass_file, c->options.auth_user_pass_file_inline, -NULL ); + c->options.auth_user_pass_username_only,NULL );#endif } }
@@ -3376,6 +3376,7 @@ } to.auth_user_pass_file = options->auth_user_pass_file; to.auth_user_pass_file_inline = options->auth_user_pass_file_inline; + to.auth_user_pass_username_only = options->auth_user_pass_username_only; to.auth_token_generate = options->auth_token_generate; to.auth_token_lifetime = options->auth_token_lifetime; to.auth_token_renewal = options->auth_token_renewal;
src/openvpn/manage.c +16 -4
@@ -58,9 +58,6 @@#define MANAGEMENT_ECHO_FLAGS 0#endif -/* tag for blank username/password */ -static const char blank_up[] ="[[BLANK]]" ; -struct management *management;/* GLOBAL */ /* static forward declarations */
@@ -729,6 +726,13 @@ {switch (man->connection.up_query_mode) { +case UP_QUERY_USERNAME : +if (strlen (man->connection.up_query.username)) + { + man->connection.up_query.defined = true; + } +break ; +case UP_QUERY_USER_PASS :if (!strlen (man->connection.up_query.username)) {
@@ -783,7 +787,9 @@ man_query_username(struct management *man, const char *type, const char *string) { const bool needed = - ((man->connection.up_query_mode ==UP_QUERY_USER_PASS ) && man->connection.up_query_type); + ((man->connection.up_query_mode ==UP_QUERY_USER_PASS + || man->connection.up_query_mode ==UP_QUERY_USERNAME ) + && man->connection.up_query_type);man_query_user_pass (man, type, string, needed,"username" , man->connection.up_query.username,USER_PASS_LEN ); }
@@ -3547,6 +3553,12 @@ prefix ="PASSWORD" ; alert_type ="password" ; } +else if ((man->connection.client_version >=4 ) && (flags &GET_USER_PASS_USERNAME_ONLY )) + { + up_query_mode =UP_QUERY_USERNAME ; + prefix ="PASSWORD" ; + alert_type ="username" ; + }else { up_query_mode =UP_QUERY_USER_PASS ;
src/openvpn/manage.h +1 -0
@@ -264,6 +264,7 @@#define UP_QUERY_PASS 2#define UP_QUERY_NEED_OK 3#define UP_QUERY_NEED_STR 4 +#define UP_QUERY_USERNAME 5/* states */ #define MS_INITIAL 0/* all sockets are closed */
src/openvpn/misc.c +7 -1
@@ -216,6 +216,12 @@msg (M_WARN ,"Note: previous '%s' credentials failed" , prefix); } +/* Use tag for blank password if we are not prompting for one */ +if (flags &GET_USER_PASS_USERNAME_ONLY ) + { +strncpy (up->password, blank_up,sizeof (up->password)); + } +#ifdef ENABLE_MANAGEMENT /* * Get username/password from management interface?
@@ -389,7 +395,7 @@query_user_add (BSTR (&user_prompt), up->username,USER_PASS_LEN , true); } -if (password_from_stdin) +if (password_from_stdin && !(flags &GET_USER_PASS_USERNAME_ONLY )) {query_user_add (BSTR (&pass_prompt), up->password,USER_PASS_LEN , false); }
src/openvpn/misc.h +5 -0
@@ -48,6 +48,9 @@* Get and store a username/password */ +/* tag for blank username/password */ +static const char blank_up[] ="[[BLANK]]" ; +struct user_pass {bool defined;
@@ -123,6 +126,8 @@#define GET_USER_PASS_INLINE_CREDS (1 << 10)/** indicates password and response should be concatenated */ #define GET_USER_PASS_STATIC_CHALLENGE_CONCAT (1 << 11) +/** indicate that only username should be prompted for auth-user-pass */ +#define GET_USER_PASS_USERNAME_ONLY (1 << 12)/** * Retrieves the user credentials from various sources depending on the flags.
src/openvpn/options.c +15 -2
@@ -510,7 +510,8 @@" up is a file containing the username on the first line,\n" " and a password on the second. If either the password or both\n" " the username and the password are omitted OpenVPN will prompt\n" -" for them from console.\n" +" for them from console. If [up] is 'username-only', only username\n" +" will be prompted for from console or management interface.\n" "--pull : Accept certain config file options from the peer as if they\n" " were part of the local config file. Must be specified\n" " when connecting to a '--mode server' remote host.\n"
@@ -3909,6 +3910,12 @@ { o->auth_token_renewal = o->renegotiate_seconds; } +#if ENABLE_MANAGEMENT +if (o->auth_user_pass_username_only && o->sc_info.challenge_text) + { +msg (M_USAGE ,"'auth-user-pass username-only' cannot be used with static challenge" ); + } +#endif pre_connect_save (o); }
@@ -7705,7 +7712,13 @@else if (streq (p[0 ],"auth-user-pass" ) && !p[2 ]) {VERIFY_PERMISSION (OPT_P_GENERAL |OPT_P_INLINE ); -if (p[1 ]) + options->auth_user_pass_username_only = false; +if (p[1 ] &&streq (p[1 ],"username-only" )) + { + options->auth_user_pass_username_only = true; + options->auth_user_pass_file ="stdin" ; + } +else if (p[1 ]) { options->auth_user_pass_file = p[1 ]; options->auth_user_pass_file_inline = is_inline;
src/openvpn/options.h +1 -0
@@ -557,6 +557,7 @@unsigned int push_update_options_found;/* tracks which option types have been reset in current PUSH_UPDATE sequence */ const char *auth_user_pass_file;bool auth_user_pass_file_inline; +bool auth_user_pass_username_only;struct options_pre_connect *pre_connect;int scheduled_exit_interval;
src/openvpn/ssl.c +10 -3
@@ -290,7 +290,8 @@ }void -auth_user_pass_setup (const char *auth_file,bool is_inline,const struct static_challenge_info *sci) +auth_user_pass_setup (const char *auth_file,bool is_inline,bool username_only, +const struct static_challenge_info *sci) {unsigned int flags =GET_USER_PASS_MANAGEMENT ;
@@ -298,6 +299,10 @@ { flags |=GET_USER_PASS_INLINE_CREDS ; } +if (username_only) + { + flags |=GET_USER_PASS_USERNAME_ONLY ; + }if (!auth_user_pass.defined && !auth_token.defined) {
@@ -2099,10 +2104,12 @@ {#ifdef ENABLE_MANAGEMENT auth_user_pass_setup (session->opt->auth_user_pass_file, - session->opt->auth_user_pass_file_inline, session->opt->sci); + session->opt->auth_user_pass_file_inline, + session->opt->auth_user_pass_username_only, session->opt->sci);#else auth_user_pass_setup (session->opt->auth_user_pass_file, - session->opt->auth_user_pass_file_inline,NULL ); + session->opt->auth_user_pass_file_inline, + session->opt->auth_user_pass_username_only,NULL );#endif struct user_pass *up = &auth_user_pass;
src/openvpn/ssl.h +1 -1
@@ -389,7 +389,7 @@* credentials stored in the file, however, if is_inline is true then auth_file * contains the username/password inline. */ -void auth_user_pass_setup (const char *auth_file,bool is_inline, +void auth_user_pass_setup (const char *auth_file,bool is_inline,bool username_only,const struct static_challenge_info *sc_info);/*
src/openvpn/ssl_common.h +1 -0
@@ -396,6 +396,7 @@const char *export_peer_cert_dir;const char *auth_user_pass_file;bool auth_user_pass_file_inline; +bool auth_user_pass_username_only;bool auth_token_generate;/**< Generate auth-tokens on successful * user/pass auth,seet via
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I788f76e6a70a9c20bca3367140d2741bd0551582
Gerrit-Change-Number: 1548
Gerrit-PatchSet: 6
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: selvanair <[email protected]...>
Attention is currently required from: flichtenheld, plaisthos.
selvanair has posted comments on this change by selvanair. ( http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email )
Change subject: Add an optional username-only flag for auth-user-pass
......................................................................
Patch Set 6:
(1 comment)
File doc/man-sections/client-options.rst:
http://gerrit.openvpn.net/c/openvpn/+/1548/comment/880fb02a_5feafc1b?usp=email :
PS5, Line 97: or password in the conifg file, or while reading them from an external file. In
Quoted 1 line
typo in conifg file. Either change on commit or have a quick revision here.
Done.
Thsi will also need a minor edit/rebase if the management-version doc patch is merged first.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I788f76e6a70a9c20bca3367140d2741bd0551582
Gerrit-Change-Number: 1548
Gerrit-PatchSet: 6
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Mon, 02 Mar 2026 20:26:40 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: plaisthos <[email protected]...>
Attention is currently required from: flichtenheld, selvanair.
plaisthos has posted comments on this change by selvanair. ( http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email )
Change subject: Add an optional username-only flag for auth-user-pass
......................................................................
Patch Set 6: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I788f76e6a70a9c20bca3367140d2741bd0551582
Gerrit-Change-Number: 1548
Gerrit-PatchSet: 6
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: selvanair <[email protected]...>
Gerrit-Comment-Date: Mon, 02 Mar 2026 20:41:41 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
PATCH v6 1/1 Add an optional username-only flag for auth-user-pass
In reply to a message not in the archiveFrom: Selva Nair <[email protected]...>
Specify "--auth-user-pass username-only" for openvpn to prompt for only username, not password. Prompt via management interface uses the usual ">PASSWORD 'Auth' " prompt with type "username" instead of "username/password".
Internally, the password gets set as "[[BLANK]]" which is currently used as tag for blank password.
Not compatible with --static-challenge or when username and password are inlined or read from a file. In such cases, the user hard-code a dummy password in the file instead.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1548
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1548
This mail reflects revision 6 of this Change.
Acked-by according to Gerrit (reflected above):
Arne Schwabe <[email protected]...>
doc/man-sections/client-options.rst +17 -1
@@ -68,7 +68,9 @@ auth-user-pass up If ``up`` is present, it must be a file containing username/password on 2 - lines. If the password line is missing, OpenVPN will prompt for one. + lines or a flag named :code:`username-only` to indicate no password + should be prompted for. In the former case, if the password line is missing + in the file, OpenVPN will prompt for one. If ``up`` is omitted, username/password will be prompted from the console.
@@ -84,6 +86,20 @@ where password is optional, and will be prompted from the console if missing. + The :code:`username-only` flag is meant to be used with SSO authentication. + In this case the user will be asked for a username but not password. Instead, + a dummy password :code:`[[BLANK]]` is generated internally and submitted to + the server. See management-notes.txt for how this option affects username/password + prompt via the management interface. For the console, it simply eliminates + the password prompt. + + The :code:`username-only` flag cannot be used along with embedding username and/or + password in the config file, or while reading them from an external file. In + such cases, if only username is relevant and no password prompt is desired, a + dummy password like 'no_passsword' should be embedded as well. This flag is also + incompatible with the ``--static-challenge`` option and legacy ``dynamic challenge`` + protocol. + The server configuration must specify an ``--auth-user-pass-verify`` script to verify the username/password provided by the client.
doc/management-notes.txt +13 -0
@@ -304,6 +304,19 @@ username "Auth" foo password "Auth" bar + Example 3: + + >PASSWORD:Need 'Auth' username + + OpenVPN needs a --auth-user-pass username. The + management interface client should respond: + + username "Auth" foo + + In this case the user should not be prompted for a password. + Support for such username-only prompting is conditional on the + client announcing a version >= 4. + The username/password itself can be in quotes, and special characters such as double quote or backslash must be escaped, for example,
src/openvpn/init.c +3 -2
@@ -655,10 +655,10 @@enable_auth_user_pass ();#ifdef ENABLE_MANAGEMENT auth_user_pass_setup (c->options.auth_user_pass_file, c->options.auth_user_pass_file_inline, - &c->options.sc_info); + c->options.auth_user_pass_username_only, &c->options.sc_info);#else auth_user_pass_setup (c->options.auth_user_pass_file, c->options.auth_user_pass_file_inline, -NULL ); + c->options.auth_user_pass_username_only,NULL );#endif } }
@@ -3376,6 +3376,7 @@ } to.auth_user_pass_file = options->auth_user_pass_file; to.auth_user_pass_file_inline = options->auth_user_pass_file_inline; + to.auth_user_pass_username_only = options->auth_user_pass_username_only; to.auth_token_generate = options->auth_token_generate; to.auth_token_lifetime = options->auth_token_lifetime; to.auth_token_renewal = options->auth_token_renewal;
src/openvpn/manage.c +16 -4
@@ -58,9 +58,6 @@#define MANAGEMENT_ECHO_FLAGS 0#endif -/* tag for blank username/password */ -static const char blank_up[] ="[[BLANK]]" ; -struct management *management;/* GLOBAL */ /* static forward declarations */
@@ -729,6 +726,13 @@ {switch (man->connection.up_query_mode) { +case UP_QUERY_USERNAME : +if (strlen (man->connection.up_query.username)) + { + man->connection.up_query.defined = true; + } +break ; +case UP_QUERY_USER_PASS :if (!strlen (man->connection.up_query.username)) {
@@ -783,7 +787,9 @@ man_query_username(struct management *man, const char *type, const char *string) { const bool needed = - ((man->connection.up_query_mode ==UP_QUERY_USER_PASS ) && man->connection.up_query_type); + ((man->connection.up_query_mode ==UP_QUERY_USER_PASS + || man->connection.up_query_mode ==UP_QUERY_USERNAME ) + && man->connection.up_query_type);man_query_user_pass (man, type, string, needed,"username" , man->connection.up_query.username,USER_PASS_LEN ); }
@@ -3547,6 +3553,12 @@ prefix ="PASSWORD" ; alert_type ="password" ; } +else if ((man->connection.client_version >=4 ) && (flags &GET_USER_PASS_USERNAME_ONLY )) + { + up_query_mode =UP_QUERY_USERNAME ; + prefix ="PASSWORD" ; + alert_type ="username" ; + }else { up_query_mode =UP_QUERY_USER_PASS ;
src/openvpn/manage.h +1 -0
@@ -264,6 +264,7 @@#define UP_QUERY_PASS 2#define UP_QUERY_NEED_OK 3#define UP_QUERY_NEED_STR 4 +#define UP_QUERY_USERNAME 5/* states */ #define MS_INITIAL 0/* all sockets are closed */
src/openvpn/misc.c +7 -1
@@ -216,6 +216,12 @@msg (M_WARN ,"Note: previous '%s' credentials failed" , prefix); } +/* Use tag for blank password if we are not prompting for one */ +if (flags &GET_USER_PASS_USERNAME_ONLY ) + { +strncpy (up->password, blank_up,sizeof (up->password)); + } +#ifdef ENABLE_MANAGEMENT /* * Get username/password from management interface?
@@ -389,7 +395,7 @@query_user_add (BSTR (&user_prompt), up->username,USER_PASS_LEN , true); } -if (password_from_stdin) +if (password_from_stdin && !(flags &GET_USER_PASS_USERNAME_ONLY )) {query_user_add (BSTR (&pass_prompt), up->password,USER_PASS_LEN , false); }
src/openvpn/misc.h +5 -0
@@ -48,6 +48,9 @@* Get and store a username/password */ +/* tag for blank username/password */ +static const char blank_up[] ="[[BLANK]]" ; +struct user_pass {bool defined;
@@ -123,6 +126,8 @@#define GET_USER_PASS_INLINE_CREDS (1 << 10)/** indicates password and response should be concatenated */ #define GET_USER_PASS_STATIC_CHALLENGE_CONCAT (1 << 11) +/** indicate that only username should be prompted for auth-user-pass */ +#define GET_USER_PASS_USERNAME_ONLY (1 << 12)/** * Retrieves the user credentials from various sources depending on the flags.
src/openvpn/options.c +15 -2
@@ -510,7 +510,8 @@" up is a file containing the username on the first line,\n" " and a password on the second. If either the password or both\n" " the username and the password are omitted OpenVPN will prompt\n" -" for them from console.\n" +" for them from console. If [up] is 'username-only', only username\n" +" will be prompted for from console or management interface.\n" "--pull : Accept certain config file options from the peer as if they\n" " were part of the local config file. Must be specified\n" " when connecting to a '--mode server' remote host.\n"
@@ -3909,6 +3910,12 @@ { o->auth_token_renewal = o->renegotiate_seconds; } +#if ENABLE_MANAGEMENT +if (o->auth_user_pass_username_only && o->sc_info.challenge_text) + { +msg (M_USAGE ,"'auth-user-pass username-only' cannot be used with static challenge" ); + } +#endif pre_connect_save (o); }
@@ -7705,7 +7712,13 @@else if (streq (p[0 ],"auth-user-pass" ) && !p[2 ]) {VERIFY_PERMISSION (OPT_P_GENERAL |OPT_P_INLINE ); -if (p[1 ]) + options->auth_user_pass_username_only = false; +if (p[1 ] &&streq (p[1 ],"username-only" )) + { + options->auth_user_pass_username_only = true; + options->auth_user_pass_file ="stdin" ; + } +else if (p[1 ]) { options->auth_user_pass_file = p[1 ]; options->auth_user_pass_file_inline = is_inline;
src/openvpn/options.h +1 -0
@@ -557,6 +557,7 @@unsigned int push_update_options_found;/* tracks which option types have been reset in current PUSH_UPDATE sequence */ const char *auth_user_pass_file;bool auth_user_pass_file_inline; +bool auth_user_pass_username_only;struct options_pre_connect *pre_connect;int scheduled_exit_interval;
src/openvpn/ssl.c +10 -3
@@ -290,7 +290,8 @@ }void -auth_user_pass_setup (const char *auth_file,bool is_inline,const struct static_challenge_info *sci) +auth_user_pass_setup (const char *auth_file,bool is_inline,bool username_only, +const struct static_challenge_info *sci) {unsigned int flags =GET_USER_PASS_MANAGEMENT ;
@@ -298,6 +299,10 @@ { flags |=GET_USER_PASS_INLINE_CREDS ; } +if (username_only) + { + flags |=GET_USER_PASS_USERNAME_ONLY ; + }if (!auth_user_pass.defined && !auth_token.defined) {
@@ -2099,10 +2104,12 @@ {#ifdef ENABLE_MANAGEMENT auth_user_pass_setup (session->opt->auth_user_pass_file, - session->opt->auth_user_pass_file_inline, session->opt->sci); + session->opt->auth_user_pass_file_inline, + session->opt->auth_user_pass_username_only, session->opt->sci);#else auth_user_pass_setup (session->opt->auth_user_pass_file, - session->opt->auth_user_pass_file_inline,NULL ); + session->opt->auth_user_pass_file_inline, + session->opt->auth_user_pass_username_only,NULL );#endif struct user_pass *up = &auth_user_pass;
src/openvpn/ssl.h +1 -1
@@ -389,7 +389,7 @@* credentials stored in the file, however, if is_inline is true then auth_file * contains the username/password inline. */ -void auth_user_pass_setup (const char *auth_file,bool is_inline, +void auth_user_pass_setup (const char *auth_file,bool is_inline,bool username_only,const struct static_challenge_info *sc_info);/*
src/openvpn/ssl_common.h +1 -0
@@ -396,6 +396,7 @@const char *export_peer_cert_dir;const char *auth_user_pass_file;bool auth_user_pass_file_inline; +bool auth_user_pass_username_only;bool auth_token_generate;/**< Generate auth-tokens on successful * user/pass auth,seet via
Re: [Openvpn-devel] [PATCH v6] Add an optional username-only flag for auth-user-pass
Quoted 2 lines
Internally, the password gets set as "[[BLANK]]" which is currently used as tag for blank password.
Unfortunately this works only when prompted from the command line. For management
interface we need to enforce this after management_query_user_pass() returns as it
overwrites the whole user_pass structure.
I can follow up with a fixup or submit a version after the management-version documentation patch is merged as that may create a conflict anyway.
Selva
Re: [Openvpn-devel] [PATCH v6] Add an optional username-only flag for auth-user-pass
Hi,
Quoted 2 lines · Selva Nair
I can follow up with a fixup or submit a version after the management-version documentation patch is merged as that may create a conflict anyway.
The "version" patch went in yesterday... :-)
gert
Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you
feed honest figures into a computer, honest figures come out. Never doubted
it myself till I met a computer with a sense of humor."
Robert A. Heinlein, The Moon is a Harsh Mistress
Gert Doering - Munich, Germany [email protected]...Re: [Openvpn-devel] [PATCH v6] Add an optional username-only flag for auth-user-pass
Hi,
Quoted 2 lines · Gert Doering
The "version" patch went in yesterday... :-)
I'm a day behind :)
I pushed it back to gerrit as there is a small fixup change in addition to rebase.
Selva
Attention is currently required from: flichtenheld, plaisthos, selvanair.
Hello plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email
to look at the new patch set (#7).
The following approvals got outdated and were removed:
Code-Review+2 by plaisthos
The change is no longer submittable: Code-Review and checks~ChecksSubmitRule are unsatisfied now.
Change subject: Add an optional username-only flag for auth-user-pass
......................................................................
Add an optional username-only flag for auth-user-pass
Specify "--auth-user-pass username-only" for openvpn to prompt for only username, not password. Prompt via management interface uses the usual ">PASSWORD 'Auth' " prompt with type "username" instead of "username/password".
Internally, the password gets set as "[[BLANK]]" which is currently used as tag for blank password.
Not compatible with --static-challenge or when username and password are inlined or read from a file. In such cases, the user hard-code a dummy password in the file instead.
---
M doc/man-sections/client-options.rst
M doc/management-notes.txt
M src/openvpn/init.c
M src/openvpn/manage.c
M src/openvpn/manage.h
M src/openvpn/misc.c
M src/openvpn/misc.h
M src/openvpn/options.c
M src/openvpn/options.h
M src/openvpn/ssl.c
M src/openvpn/ssl.h
M src/openvpn/ssl_common.h
12 files changed, 92 insertions(+), 15 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/48/1548/7
doc/man-sections/client-options.rst +17 -1
@@ -68,7 +68,9 @@ auth-user-pass up If ``up`` is present, it must be a file containing username/password on 2 - lines. If the password line is missing, OpenVPN will prompt for one. + lines or a flag named :code:`username-only` to indicate no password + should be prompted for. In the former case, if the password line is missing + in the file, OpenVPN will prompt for one. If ``up`` is omitted, username/password will be prompted from the console.
@@ -84,6 +86,20 @@ where password is optional, and will be prompted from the console if missing. + The :code:`username-only` flag is meant to be used with SSO authentication. + In this case the user will be asked for a username but not password. Instead, + a dummy password :code:`[[BLANK]]` is generated internally and submitted to + the server. See management-notes.txt for how this option affects username/password + prompt via the management interface. For the console, it simply eliminates + the password prompt. + + The :code:`username-only` flag cannot be used along with embedding username and/or + password in the config file, or while reading them from an external file. In + such cases, if only username is relevant and no password prompt is desired, a + dummy password like 'no_passsword' should be embedded as well. This flag is also + incompatible with the ``--static-challenge`` option and legacy ``dynamic challenge`` + protocol. + The server configuration must specify an ``--auth-user-pass-verify`` script to verify the username/password provided by the client.
doc/management-notes.txt +14 -0
@@ -304,6 +304,19 @@ username "Auth" foo password "Auth" bar + Example 3: + + >PASSWORD:Need 'Auth' username + + OpenVPN needs a --auth-user-pass username. The + management interface client should respond: + + username "Auth" foo + + In this case the user should not be prompted for a password. + Support for such username-only prompting is conditional on the + client announcing a version >= 4. + The username/password itself can be in quotes, and special characters such as double quote or backslash must be escaped, for example,
@@ -499,6 +512,7 @@ Minimum client version required for certain features is listed below: >PK_SIGN:[base64] -- version 2 or greater >PK_SIGN:[base64],[alg] -- version 3 or greater + >PASSWORD:Need 'Auth' username -- version 4 or greater COMMAND -- auth-retry ---------------------
src/openvpn/init.c +3 -2
@@ -655,10 +655,10 @@enable_auth_user_pass ();#ifdef ENABLE_MANAGEMENT auth_user_pass_setup (c->options.auth_user_pass_file, c->options.auth_user_pass_file_inline, - &c->options.sc_info); + c->options.auth_user_pass_username_only, &c->options.sc_info);#else auth_user_pass_setup (c->options.auth_user_pass_file, c->options.auth_user_pass_file_inline, -NULL ); + c->options.auth_user_pass_username_only,NULL );#endif } }
@@ -3376,6 +3376,7 @@ } to.auth_user_pass_file = options->auth_user_pass_file; to.auth_user_pass_file_inline = options->auth_user_pass_file_inline; + to.auth_user_pass_username_only = options->auth_user_pass_username_only; to.auth_token_generate = options->auth_token_generate; to.auth_token_lifetime = options->auth_token_lifetime; to.auth_token_renewal = options->auth_token_renewal;
src/openvpn/manage.c +17 -4
@@ -58,9 +58,6 @@#define MANAGEMENT_ECHO_FLAGS 0#endif -/* tag for blank username/password */ -static const char blank_up[] ="[[BLANK]]" ; -/* * Management client versions indicating feature support in client. * Append new values as needed but do not change exisiting ones.
@@ -70,6 +67,7 @@MCV_DEFAULT =1 ,MCV_PKSIGN =2 ,MCV_PKSIGN_ALG =3 , + MCV_USERNAME_ONLY = 4, };struct management *management;/* GLOBAL */
@@ -740,6 +738,13 @@ {switch (man->connection.up_query_mode) { +case UP_QUERY_USERNAME : +if (strlen (man->connection.up_query.username)) + { + man->connection.up_query.defined = true; + } +break ; +case UP_QUERY_USER_PASS :if (!strlen (man->connection.up_query.username)) {
@@ -794,7 +799,9 @@ man_query_username(struct management *man, const char *type, const char *string) { const bool needed = - ((man->connection.up_query_mode ==UP_QUERY_USER_PASS ) && man->connection.up_query_type); + ((man->connection.up_query_mode ==UP_QUERY_USER_PASS + || man->connection.up_query_mode ==UP_QUERY_USERNAME ) + && man->connection.up_query_type);man_query_user_pass (man, type, string, needed,"username" , man->connection.up_query.username,USER_PASS_LEN ); }
@@ -3558,6 +3565,12 @@ prefix ="PASSWORD" ; alert_type ="password" ; } +else if ((man->connection.client_version >=MCV_USERNAME_ONLY ) && (flags &GET_USER_PASS_USERNAME_ONLY )) + { + up_query_mode =UP_QUERY_USERNAME ; + prefix ="PASSWORD" ; + alert_type ="username" ; + }else { up_query_mode =UP_QUERY_USER_PASS ;
src/openvpn/manage.h +1 -0
@@ -264,6 +264,7 @@#define UP_QUERY_PASS 2#define UP_QUERY_NEED_OK 3#define UP_QUERY_NEED_STR 4 +#define UP_QUERY_USERNAME 5/* states */ #define MS_INITIAL 0/* all sockets are closed */
src/openvpn/misc.c +7 -2
@@ -215,7 +215,6 @@ {msg (M_WARN ,"Note: previous '%s' credentials failed" , prefix); } -#ifdef ENABLE_MANAGEMENT /* * Get username/password from management interface?
@@ -389,7 +388,7 @@query_user_add (BSTR (&user_prompt), up->username,USER_PASS_LEN , true); } -if (password_from_stdin) +if (password_from_stdin && !(flags &GET_USER_PASS_USERNAME_ONLY )) {query_user_add (BSTR (&pass_prompt), up->password,USER_PASS_LEN , false); }
@@ -451,6 +450,12 @@ } } +/* Use tag for blank password if we are not prompting for one */ +if (flags &GET_USER_PASS_USERNAME_ONLY ) + { +strncpy (up->password, blank_up,sizeof (up->password)); + } +string_mod (up->username,CC_PRINT ,CC_CRLF ,0 );string_mod (up->password,CC_PRINT ,CC_CRLF ,0 );
src/openvpn/misc.h +5 -0
@@ -48,6 +48,9 @@* Get and store a username/password */ +/* tag for blank username/password */ +static const char blank_up[] ="[[BLANK]]" ; +struct user_pass {bool defined;
@@ -123,6 +126,8 @@#define GET_USER_PASS_INLINE_CREDS (1 << 10)/** indicates password and response should be concatenated */ #define GET_USER_PASS_STATIC_CHALLENGE_CONCAT (1 << 11) +/** indicate that only username should be prompted for auth-user-pass */ +#define GET_USER_PASS_USERNAME_ONLY (1 << 12)/** * Retrieves the user credentials from various sources depending on the flags.
src/openvpn/options.c +15 -2
@@ -510,7 +510,8 @@" up is a file containing the username on the first line,\n" " and a password on the second. If either the password or both\n" " the username and the password are omitted OpenVPN will prompt\n" -" for them from console.\n" +" for them from console. If [up] is 'username-only', only username\n" +" will be prompted for from console or management interface.\n" "--pull : Accept certain config file options from the peer as if they\n" " were part of the local config file. Must be specified\n" " when connecting to a '--mode server' remote host.\n"
@@ -3909,6 +3910,12 @@ { o->auth_token_renewal = o->renegotiate_seconds; } +#if ENABLE_MANAGEMENT +if (o->auth_user_pass_username_only && o->sc_info.challenge_text) + { +msg (M_USAGE ,"'auth-user-pass username-only' cannot be used with static challenge" ); + } +#endif pre_connect_save (o); }
@@ -7705,7 +7712,13 @@else if (streq (p[0 ],"auth-user-pass" ) && !p[2 ]) {VERIFY_PERMISSION (OPT_P_GENERAL |OPT_P_INLINE ); -if (p[1 ]) + options->auth_user_pass_username_only = false; +if (p[1 ] &&streq (p[1 ],"username-only" )) + { + options->auth_user_pass_username_only = true; + options->auth_user_pass_file ="stdin" ; + } +else if (p[1 ]) { options->auth_user_pass_file = p[1 ]; options->auth_user_pass_file_inline = is_inline;
src/openvpn/options.h +1 -0
@@ -557,6 +557,7 @@unsigned int push_update_options_found;/* tracks which option types have been reset in current PUSH_UPDATE sequence */ const char *auth_user_pass_file;bool auth_user_pass_file_inline; +bool auth_user_pass_username_only;struct options_pre_connect *pre_connect;int scheduled_exit_interval;
src/openvpn/ssl.c +10 -3
@@ -290,7 +290,8 @@ }void -auth_user_pass_setup (const char *auth_file,bool is_inline,const struct static_challenge_info *sci) +auth_user_pass_setup (const char *auth_file,bool is_inline,bool username_only, +const struct static_challenge_info *sci) {unsigned int flags =GET_USER_PASS_MANAGEMENT ;
@@ -298,6 +299,10 @@ { flags |=GET_USER_PASS_INLINE_CREDS ; } +if (username_only) + { + flags |=GET_USER_PASS_USERNAME_ONLY ; + }if (!auth_user_pass.defined && !auth_token.defined) {
@@ -2099,10 +2104,12 @@ {#ifdef ENABLE_MANAGEMENT auth_user_pass_setup (session->opt->auth_user_pass_file, - session->opt->auth_user_pass_file_inline, session->opt->sci); + session->opt->auth_user_pass_file_inline, + session->opt->auth_user_pass_username_only, session->opt->sci);#else auth_user_pass_setup (session->opt->auth_user_pass_file, - session->opt->auth_user_pass_file_inline,NULL ); + session->opt->auth_user_pass_file_inline, + session->opt->auth_user_pass_username_only,NULL );#endif struct user_pass *up = &auth_user_pass;
src/openvpn/ssl.h +1 -1
@@ -389,7 +389,7 @@* credentials stored in the file, however, if is_inline is true then auth_file * contains the username/password inline. */ -void auth_user_pass_setup (const char *auth_file,bool is_inline, +void auth_user_pass_setup (const char *auth_file,bool is_inline,bool username_only,const struct static_challenge_info *sc_info);/*
src/openvpn/ssl_common.h +1 -0
@@ -396,6 +396,7 @@const char *export_peer_cert_dir;const char *auth_user_pass_file;bool auth_user_pass_file_inline; +bool auth_user_pass_username_only;bool auth_token_generate;/**< Generate auth-tokens on successful * user/pass auth,seet via
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I788f76e6a70a9c20bca3367140d2741bd0551582
Gerrit-Change-Number: 1548
Gerrit-PatchSet: 7
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: selvanair <[email protected]...>
Attention is currently required from: flichtenheld, plaisthos.
selvanair has posted comments on this change by selvanair. ( http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email )
Change subject: Add an optional username-only flag for auth-user-pass
......................................................................
Patch Set 7:
(1 comment)
Patchset:
PS6:
- fixed conflicts with management-version doc patch
- added version = MCV_USERNAME_ONLY instead of version = 4
- moved setting password = "[[BLANK]]" to the end of get_user_pass_cr() to enforce it always
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I788f76e6a70a9c20bca3367140d2741bd0551582
Gerrit-Change-Number: 1548
Gerrit-PatchSet: 7
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 03 Mar 2026 13:49:43 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Attention is currently required from: flichtenheld, selvanair.
plaisthos has posted comments on this change by selvanair. ( http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email )
Change subject: Add an optional username-only flag for auth-user-pass
......................................................................
Patch Set 7: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I788f76e6a70a9c20bca3367140d2741bd0551582
Gerrit-Change-Number: 1548
Gerrit-PatchSet: 7
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: selvanair <[email protected]...>
Gerrit-Comment-Date: Tue, 03 Mar 2026 13:50:32 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
PATCH v7 1/1 Add an optional username-only flag for auth-user-pass
In reply to a message not in the archiveFrom: Selva Nair <[email protected]...>
Specify "--auth-user-pass username-only" for openvpn to prompt for only username, not password. Prompt via management interface uses the usual ">PASSWORD 'Auth' " prompt with type "username" instead of "username/password".
Internally, the password gets set as "[[BLANK]]" which is currently used as tag for blank password.
Not compatible with --static-challenge or when username and password are inlined or read from a file. In such cases, the user hard-code a dummy password in the file instead.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1548
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1548
This mail reflects revision 7 of this Change.
Acked-by according to Gerrit (reflected above):
Arne Schwabe <[email protected]...>
doc/man-sections/client-options.rst +17 -1
@@ -68,7 +68,9 @@ auth-user-pass up If ``up`` is present, it must be a file containing username/password on 2 - lines. If the password line is missing, OpenVPN will prompt for one. + lines or a flag named :code:`username-only` to indicate no password + should be prompted for. In the former case, if the password line is missing + in the file, OpenVPN will prompt for one. If ``up`` is omitted, username/password will be prompted from the console.
@@ -84,6 +86,20 @@ where password is optional, and will be prompted from the console if missing. + The :code:`username-only` flag is meant to be used with SSO authentication. + In this case the user will be asked for a username but not password. Instead, + a dummy password :code:`[[BLANK]]` is generated internally and submitted to + the server. See management-notes.txt for how this option affects username/password + prompt via the management interface. For the console, it simply eliminates + the password prompt. + + The :code:`username-only` flag cannot be used along with embedding username and/or + password in the config file, or while reading them from an external file. In + such cases, if only username is relevant and no password prompt is desired, a + dummy password like 'no_passsword' should be embedded as well. This flag is also + incompatible with the ``--static-challenge`` option and legacy ``dynamic challenge`` + protocol. + The server configuration must specify an ``--auth-user-pass-verify`` script to verify the username/password provided by the client.
doc/management-notes.txt +14 -0
@@ -304,6 +304,19 @@ username "Auth" foo password "Auth" bar + Example 3: + + >PASSWORD:Need 'Auth' username + + OpenVPN needs a --auth-user-pass username. The + management interface client should respond: + + username "Auth" foo + + In this case the user should not be prompted for a password. + Support for such username-only prompting is conditional on the + client announcing a version >= 4. + The username/password itself can be in quotes, and special characters such as double quote or backslash must be escaped, for example,
@@ -499,6 +512,7 @@ Minimum client version required for certain features is listed below: >PK_SIGN:[base64] -- version 2 or greater >PK_SIGN:[base64],[alg] -- version 3 or greater + >PASSWORD:Need 'Auth' username -- version 4 or greater COMMAND -- auth-retry ---------------------
src/openvpn/init.c +3 -2
@@ -655,10 +655,10 @@enable_auth_user_pass ();#ifdef ENABLE_MANAGEMENT auth_user_pass_setup (c->options.auth_user_pass_file, c->options.auth_user_pass_file_inline, - &c->options.sc_info); + c->options.auth_user_pass_username_only, &c->options.sc_info);#else auth_user_pass_setup (c->options.auth_user_pass_file, c->options.auth_user_pass_file_inline, -NULL ); + c->options.auth_user_pass_username_only,NULL );#endif } }
@@ -3376,6 +3376,7 @@ } to.auth_user_pass_file = options->auth_user_pass_file; to.auth_user_pass_file_inline = options->auth_user_pass_file_inline; + to.auth_user_pass_username_only = options->auth_user_pass_username_only; to.auth_token_generate = options->auth_token_generate; to.auth_token_lifetime = options->auth_token_lifetime; to.auth_token_renewal = options->auth_token_renewal;
src/openvpn/manage.c +17 -4
@@ -58,9 +58,6 @@#define MANAGEMENT_ECHO_FLAGS 0#endif -/* tag for blank username/password */ -static const char blank_up[] ="[[BLANK]]" ; -/* * Management client versions indicating feature support in client. * Append new values as needed but do not change exisiting ones.
@@ -70,6 +67,7 @@MCV_DEFAULT =1 ,MCV_PKSIGN =2 ,MCV_PKSIGN_ALG =3 , + MCV_USERNAME_ONLY = 4, };struct management *management;/* GLOBAL */
@@ -740,6 +738,13 @@ {switch (man->connection.up_query_mode) { +case UP_QUERY_USERNAME : +if (strlen (man->connection.up_query.username)) + { + man->connection.up_query.defined = true; + } +break ; +case UP_QUERY_USER_PASS :if (!strlen (man->connection.up_query.username)) {
@@ -794,7 +799,9 @@ man_query_username(struct management *man, const char *type, const char *string) { const bool needed = - ((man->connection.up_query_mode ==UP_QUERY_USER_PASS ) && man->connection.up_query_type); + ((man->connection.up_query_mode ==UP_QUERY_USER_PASS + || man->connection.up_query_mode ==UP_QUERY_USERNAME ) + && man->connection.up_query_type);man_query_user_pass (man, type, string, needed,"username" , man->connection.up_query.username,USER_PASS_LEN ); }
@@ -3558,6 +3565,12 @@ prefix ="PASSWORD" ; alert_type ="password" ; } +else if ((man->connection.client_version >=MCV_USERNAME_ONLY ) && (flags &GET_USER_PASS_USERNAME_ONLY )) + { + up_query_mode =UP_QUERY_USERNAME ; + prefix ="PASSWORD" ; + alert_type ="username" ; + }else { up_query_mode =UP_QUERY_USER_PASS ;
src/openvpn/manage.h +1 -0
@@ -264,6 +264,7 @@#define UP_QUERY_PASS 2#define UP_QUERY_NEED_OK 3#define UP_QUERY_NEED_STR 4 +#define UP_QUERY_USERNAME 5/* states */ #define MS_INITIAL 0/* all sockets are closed */
src/openvpn/misc.c +7 -2
@@ -215,7 +215,6 @@ {msg (M_WARN ,"Note: previous '%s' credentials failed" , prefix); } -#ifdef ENABLE_MANAGEMENT /* * Get username/password from management interface?
@@ -389,7 +388,7 @@query_user_add (BSTR (&user_prompt), up->username,USER_PASS_LEN , true); } -if (password_from_stdin) +if (password_from_stdin && !(flags &GET_USER_PASS_USERNAME_ONLY )) {query_user_add (BSTR (&pass_prompt), up->password,USER_PASS_LEN , false); }
@@ -451,6 +450,12 @@ } } +/* Use tag for blank password if we are not prompting for one */ +if (flags &GET_USER_PASS_USERNAME_ONLY ) + { +strncpy (up->password, blank_up,sizeof (up->password)); + } +string_mod (up->username,CC_PRINT ,CC_CRLF ,0 );string_mod (up->password,CC_PRINT ,CC_CRLF ,0 );
src/openvpn/misc.h +5 -0
@@ -48,6 +48,9 @@* Get and store a username/password */ +/* tag for blank username/password */ +static const char blank_up[] ="[[BLANK]]" ; +struct user_pass {bool defined;
@@ -123,6 +126,8 @@#define GET_USER_PASS_INLINE_CREDS (1 << 10)/** indicates password and response should be concatenated */ #define GET_USER_PASS_STATIC_CHALLENGE_CONCAT (1 << 11) +/** indicate that only username should be prompted for auth-user-pass */ +#define GET_USER_PASS_USERNAME_ONLY (1 << 12)/** * Retrieves the user credentials from various sources depending on the flags.
src/openvpn/options.c +15 -2
@@ -510,7 +510,8 @@" up is a file containing the username on the first line,\n" " and a password on the second. If either the password or both\n" " the username and the password are omitted OpenVPN will prompt\n" -" for them from console.\n" +" for them from console. If [up] is 'username-only', only username\n" +" will be prompted for from console or management interface.\n" "--pull : Accept certain config file options from the peer as if they\n" " were part of the local config file. Must be specified\n" " when connecting to a '--mode server' remote host.\n"
@@ -3909,6 +3910,12 @@ { o->auth_token_renewal = o->renegotiate_seconds; } +#if ENABLE_MANAGEMENT +if (o->auth_user_pass_username_only && o->sc_info.challenge_text) + { +msg (M_USAGE ,"'auth-user-pass username-only' cannot be used with static challenge" ); + } +#endif pre_connect_save (o); }
@@ -7705,7 +7712,13 @@else if (streq (p[0 ],"auth-user-pass" ) && !p[2 ]) {VERIFY_PERMISSION (OPT_P_GENERAL |OPT_P_INLINE ); -if (p[1 ]) + options->auth_user_pass_username_only = false; +if (p[1 ] &&streq (p[1 ],"username-only" )) + { + options->auth_user_pass_username_only = true; + options->auth_user_pass_file ="stdin" ; + } +else if (p[1 ]) { options->auth_user_pass_file = p[1 ]; options->auth_user_pass_file_inline = is_inline;
src/openvpn/options.h +1 -0
@@ -557,6 +557,7 @@unsigned int push_update_options_found;/* tracks which option types have been reset in current PUSH_UPDATE sequence */ const char *auth_user_pass_file;bool auth_user_pass_file_inline; +bool auth_user_pass_username_only;struct options_pre_connect *pre_connect;int scheduled_exit_interval;
src/openvpn/ssl.c +10 -3
@@ -290,7 +290,8 @@ }void -auth_user_pass_setup (const char *auth_file,bool is_inline,const struct static_challenge_info *sci) +auth_user_pass_setup (const char *auth_file,bool is_inline,bool username_only, +const struct static_challenge_info *sci) {unsigned int flags =GET_USER_PASS_MANAGEMENT ;
@@ -298,6 +299,10 @@ { flags |=GET_USER_PASS_INLINE_CREDS ; } +if (username_only) + { + flags |=GET_USER_PASS_USERNAME_ONLY ; + }if (!auth_user_pass.defined && !auth_token.defined) {
@@ -2099,10 +2104,12 @@ {#ifdef ENABLE_MANAGEMENT auth_user_pass_setup (session->opt->auth_user_pass_file, - session->opt->auth_user_pass_file_inline, session->opt->sci); + session->opt->auth_user_pass_file_inline, + session->opt->auth_user_pass_username_only, session->opt->sci);#else auth_user_pass_setup (session->opt->auth_user_pass_file, - session->opt->auth_user_pass_file_inline,NULL ); + session->opt->auth_user_pass_file_inline, + session->opt->auth_user_pass_username_only,NULL );#endif struct user_pass *up = &auth_user_pass;
src/openvpn/ssl.h +1 -1
@@ -389,7 +389,7 @@* credentials stored in the file, however, if is_inline is true then auth_file * contains the username/password inline. */ -void auth_user_pass_setup (const char *auth_file,bool is_inline, +void auth_user_pass_setup (const char *auth_file,bool is_inline,bool username_only,const struct static_challenge_info *sc_info);/*
src/openvpn/ssl_common.h +1 -0
@@ -396,6 +396,7 @@const char *export_peer_cert_dir;const char *auth_user_pass_file;bool auth_user_pass_file_inline; +bool auth_user_pass_username_only;bool auth_token_generate;/**< Generate auth-tokens on successful * user/pass auth,seet via
[Openvpn-devel] [PATCH applied] Re: Add an optional username-only flag for auth-user-pass
Sorry for being slow here. Busy times...
This said, I have not tested this for real - this is a much larger task coming up, building a proper test rig that tests the gazillion of auth options we have in a proper way... - staring at the code, the change makes sense, support can be queried from the GUI, so everything should work out nicely.
Tests on the client/server testbeds pass fine, so "nothing else got broken, and basic --auth-user-pass $file still works".
Since 2.7 will be with us for a long time, and we're still in the very low release numbers, I think having this in release/2.7 "fairly localized change, low impact on high-risk areas of the code" is ok.
Your patch has been applied to the master and release/2.7 branch.
commit dfbf80b0a04a986fc5b5d5fef67d86ce68439b0b (master) commit 96781b42f2b9ecf28ace4fbe97ac868477eef480 (release/2.7)
Author: Selva Nair Date: Tue Mar 3 15:28:14 2026 +0100
Add an optional username-only flag for auth-user-pass
Signed-off-by: Selva Nair <[email protected]...>
Acked-by: Arne Schwabe <[email protected]...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1548
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35855.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
Attention is currently required from: flichtenheld.
selvanair has posted comments on this change by selvanair. ( http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email )
Change subject: Add an optional username-only flag for auth-user-pass
......................................................................
Patch Set 7:
(1 comment)
Patchset:
PS7:
Status of this shows something missing, but unsure what that is.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I788f76e6a70a9c20bca3367140d2741bd0551582
Gerrit-Change-Number: 1548
Gerrit-PatchSet: 7
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 24 Mar 2026 20:55:23 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Attention is currently required from: flichtenheld, selvanair.
cron2 has posted comments on this change by selvanair. ( http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email )
Change subject: Add an optional username-only flag for auth-user-pass
......................................................................
Patch Set 7:
(1 comment)
Patchset:
PS7:
Quoted 1 line
Status of this shows something missing, but unsure what that is.
time on my side. Sorry, busy weeks, and got saturated with "easy and small" patches. Should get to it this weekend.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I788f76e6a70a9c20bca3367140d2741bd0551582
Gerrit-Change-Number: 1548
Gerrit-PatchSet: 7
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: selvanair <[email protected]...>
Gerrit-Comment-Date: Tue, 24 Mar 2026 21:13:52 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: selvanair <[email protected]...>
Attention is currently required from: cron2, selvanair.
flichtenheld has posted comments on this change by selvanair. ( http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email )
Change subject: Add an optional username-only flag for auth-user-pass
......................................................................
Patch Set 7:
(1 comment)
Patchset:
PS7:
Quoted 1 line
time on my side. Sorry, busy weeks, and got saturated with "easy and small" patches. […]
The checks rule is unsatisfied since we added Ubuntu 26.04 builds but they are not done for existing patches (until they are rebased). But that is not an issue since we do not use these criteria in any automated way. So nothing for you to do here. As Gert said it just waits in the queue.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I788f76e6a70a9c20bca3367140d2741bd0551582
Gerrit-Change-Number: 1548
Gerrit-PatchSet: 7
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: selvanair <[email protected]...>
Gerrit-Comment-Date: Wed, 25 Mar 2026 11:16:36 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: cron2 <[email protected]...>
Comment-In-Reply-To: selvanair <[email protected]...>
cron2 has uploaded a new patch set (#8) to the change originally created by selvanair. ( http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by plaisthos
Change subject: Add an optional username-only flag for auth-user-pass
......................................................................
Add an optional username-only flag for auth-user-pass
Specify "--auth-user-pass username-only" for openvpn to prompt for only username, not password. Prompt via management interface uses the usual ">PASSWORD 'Auth' " prompt with type "username" instead of "username/password".
Internally, the password gets set as "[[BLANK]]" which is currently used as tag for blank password.
Not compatible with --static-challenge or when username and password are inlined or read from a file. In such cases, the user hard-code a dummy password in the file instead.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1548
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35855.html
---
M doc/man-sections/client-options.rst
M doc/management-notes.txt
M src/openvpn/init.c
M src/openvpn/manage.c
M src/openvpn/manage.h
M src/openvpn/misc.c
M src/openvpn/misc.h
M src/openvpn/options.c
M src/openvpn/options.h
M src/openvpn/ssl.c
M src/openvpn/ssl.h
M src/openvpn/ssl_common.h
12 files changed, 92 insertions(+), 15 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/48/1548/8
doc/man-sections/client-options.rst +17 -1
@@ -68,7 +68,9 @@ auth-user-pass up If ``up`` is present, it must be a file containing username/password on 2 - lines. If the password line is missing, OpenVPN will prompt for one. + lines or a flag named :code:`username-only` to indicate no password + should be prompted for. In the former case, if the password line is missing + in the file, OpenVPN will prompt for one. If ``up`` is omitted, username/password will be prompted from the console.
@@ -84,6 +86,20 @@ where password is optional, and will be prompted from the console if missing. + The :code:`username-only` flag is meant to be used with SSO authentication. + In this case the user will be asked for a username but not password. Instead, + a dummy password :code:`[[BLANK]]` is generated internally and submitted to + the server. See management-notes.txt for how this option affects username/password + prompt via the management interface. For the console, it simply eliminates + the password prompt. + + The :code:`username-only` flag cannot be used along with embedding username and/or + password in the config file, or while reading them from an external file. In + such cases, if only username is relevant and no password prompt is desired, a + dummy password like 'no_passsword' should be embedded as well. This flag is also + incompatible with the ``--static-challenge`` option and legacy ``dynamic challenge`` + protocol. + The server configuration must specify an ``--auth-user-pass-verify`` script to verify the username/password provided by the client.
doc/management-notes.txt +14 -0
@@ -304,6 +304,19 @@ username "Auth" foo password "Auth" bar + Example 3: + + >PASSWORD:Need 'Auth' username + + OpenVPN needs a --auth-user-pass username. The + management interface client should respond: + + username "Auth" foo + + In this case the user should not be prompted for a password. + Support for such username-only prompting is conditional on the + client announcing a version >= 4. + The username/password itself can be in quotes, and special characters such as double quote or backslash must be escaped, for example,
@@ -499,6 +512,7 @@ Minimum client version required for certain features is listed below: >PK_SIGN:[base64] -- version 2 or greater >PK_SIGN:[base64],[alg] -- version 3 or greater + >PASSWORD:Need 'Auth' username -- version 4 or greater COMMAND -- auth-retry ---------------------
src/openvpn/init.c +3 -2
@@ -665,10 +665,10 @@enable_auth_user_pass ();#ifdef ENABLE_MANAGEMENT auth_user_pass_setup (c->options.auth_user_pass_file, c->options.auth_user_pass_file_inline, - &c->options.sc_info); + c->options.auth_user_pass_username_only, &c->options.sc_info);#else auth_user_pass_setup (c->options.auth_user_pass_file, c->options.auth_user_pass_file_inline, -NULL ); + c->options.auth_user_pass_username_only,NULL );#endif } }
@@ -3386,6 +3386,7 @@ } to.auth_user_pass_file = options->auth_user_pass_file; to.auth_user_pass_file_inline = options->auth_user_pass_file_inline; + to.auth_user_pass_username_only = options->auth_user_pass_username_only; to.auth_token_generate = options->auth_token_generate; to.auth_token_lifetime = options->auth_token_lifetime; to.auth_token_renewal = options->auth_token_renewal;
src/openvpn/manage.c +17 -4
@@ -58,9 +58,6 @@#define MANAGEMENT_ECHO_FLAGS 0#endif -/* tag for blank username/password */ -static const char blank_up[] ="[[BLANK]]" ; -/* * Management client versions indicating feature support in client. * Append new values as needed but do not change exisiting ones.
@@ -70,6 +67,7 @@MCV_DEFAULT =1 ,MCV_PKSIGN =2 ,MCV_PKSIGN_ALG =3 , + MCV_USERNAME_ONLY = 4, };struct management *management;/* GLOBAL */
@@ -740,6 +738,13 @@ {switch (man->connection.up_query_mode) { +case UP_QUERY_USERNAME : +if (strlen (man->connection.up_query.username)) + { + man->connection.up_query.defined = true; + } +break ; +case UP_QUERY_USER_PASS :if (!strlen (man->connection.up_query.username)) {
@@ -794,7 +799,9 @@ man_query_username(struct management *man, const char *type, const char *string) { const bool needed = - ((man->connection.up_query_mode ==UP_QUERY_USER_PASS ) && man->connection.up_query_type); + ((man->connection.up_query_mode ==UP_QUERY_USER_PASS + || man->connection.up_query_mode ==UP_QUERY_USERNAME ) + && man->connection.up_query_type);man_query_user_pass (man, type, string, needed,"username" , man->connection.up_query.username,USER_PASS_LEN ); }
@@ -3558,6 +3565,12 @@ prefix ="PASSWORD" ; alert_type ="password" ; } +else if ((man->connection.client_version >=MCV_USERNAME_ONLY ) && (flags &GET_USER_PASS_USERNAME_ONLY )) + { + up_query_mode =UP_QUERY_USERNAME ; + prefix ="PASSWORD" ; + alert_type ="username" ; + }else { up_query_mode =UP_QUERY_USER_PASS ;
src/openvpn/manage.h +1 -0
@@ -264,6 +264,7 @@#define UP_QUERY_PASS 2#define UP_QUERY_NEED_OK 3#define UP_QUERY_NEED_STR 4 +#define UP_QUERY_USERNAME 5/* states */ #define MS_INITIAL 0/* all sockets are closed */
src/openvpn/misc.c +7 -2
@@ -215,7 +215,6 @@ {msg (M_WARN ,"Note: previous '%s' credentials failed" , prefix); } -#ifdef ENABLE_MANAGEMENT /* * Get username/password from management interface?
@@ -389,7 +388,7 @@query_user_add (BSTR (&user_prompt), up->username,USER_PASS_LEN , true); } -if (password_from_stdin) +if (password_from_stdin && !(flags &GET_USER_PASS_USERNAME_ONLY )) {query_user_add (BSTR (&pass_prompt), up->password,USER_PASS_LEN , false); }
@@ -451,6 +450,12 @@ } } +/* Use tag for blank password if we are not prompting for one */ +if (flags &GET_USER_PASS_USERNAME_ONLY ) + { +strncpy (up->password, blank_up,sizeof (up->password)); + } +string_mod (up->username,CC_PRINT ,CC_CRLF ,0 );string_mod (up->password,CC_PRINT ,CC_CRLF ,0 );
src/openvpn/misc.h +5 -0
@@ -48,6 +48,9 @@* Get and store a username/password */ +/* tag for blank username/password */ +static const char blank_up[] ="[[BLANK]]" ; +struct user_pass {bool defined;
@@ -123,6 +126,8 @@#define GET_USER_PASS_INLINE_CREDS (1 << 10)/** indicates password and response should be concatenated */ #define GET_USER_PASS_STATIC_CHALLENGE_CONCAT (1 << 11) +/** indicate that only username should be prompted for auth-user-pass */ +#define GET_USER_PASS_USERNAME_ONLY (1 << 12)/** * Retrieves the user credentials from various sources depending on the flags.
src/openvpn/options.c +15 -2
@@ -510,7 +510,8 @@" up is a file containing the username on the first line,\n" " and a password on the second. If either the password or both\n" " the username and the password are omitted OpenVPN will prompt\n" -" for them from console.\n" +" for them from console. If [up] is 'username-only', only username\n" +" will be prompted for from console or management interface.\n" "--pull : Accept certain config file options from the peer as if they\n" " were part of the local config file. Must be specified\n" " when connecting to a '--mode server' remote host.\n"
@@ -3926,6 +3927,12 @@ { o->auth_token_renewal = o->renegotiate_seconds; } +#if ENABLE_MANAGEMENT +if (o->auth_user_pass_username_only && o->sc_info.challenge_text) + { +msg (M_USAGE ,"'auth-user-pass username-only' cannot be used with static challenge" ); + } +#endif pre_connect_save (o); }
@@ -7736,7 +7743,13 @@else if (streq (p[0 ],"auth-user-pass" ) && !p[2 ]) {VERIFY_PERMISSION (OPT_P_GENERAL |OPT_P_INLINE ); -if (p[1 ]) + options->auth_user_pass_username_only = false; +if (p[1 ] &&streq (p[1 ],"username-only" )) + { + options->auth_user_pass_username_only = true; + options->auth_user_pass_file ="stdin" ; + } +else if (p[1 ]) { options->auth_user_pass_file = p[1 ]; options->auth_user_pass_file_inline = is_inline;
src/openvpn/options.h +1 -0
@@ -557,6 +557,7 @@uint64_t push_update_options_found;/* tracks which option types have been reset in current PUSH_UPDATE sequence */ const char *auth_user_pass_file;bool auth_user_pass_file_inline; +bool auth_user_pass_username_only;struct options_pre_connect *pre_connect;int scheduled_exit_interval;
src/openvpn/ssl.c +10 -3
@@ -290,7 +290,8 @@ }void -auth_user_pass_setup (const char *auth_file,bool is_inline,const struct static_challenge_info *sci) +auth_user_pass_setup (const char *auth_file,bool is_inline,bool username_only, +const struct static_challenge_info *sci) {unsigned int flags =GET_USER_PASS_MANAGEMENT ;
@@ -298,6 +299,10 @@ { flags |=GET_USER_PASS_INLINE_CREDS ; } +if (username_only) + { + flags |=GET_USER_PASS_USERNAME_ONLY ; + }if (!auth_user_pass.defined && !auth_token.defined) {
@@ -2099,10 +2104,12 @@ {#ifdef ENABLE_MANAGEMENT auth_user_pass_setup (session->opt->auth_user_pass_file, - session->opt->auth_user_pass_file_inline, session->opt->sci); + session->opt->auth_user_pass_file_inline, + session->opt->auth_user_pass_username_only, session->opt->sci);#else auth_user_pass_setup (session->opt->auth_user_pass_file, - session->opt->auth_user_pass_file_inline,NULL ); + session->opt->auth_user_pass_file_inline, + session->opt->auth_user_pass_username_only,NULL );#endif struct user_pass *up = &auth_user_pass;
src/openvpn/ssl.h +1 -1
@@ -389,7 +389,7 @@* credentials stored in the file, however, if is_inline is true then auth_file * contains the username/password inline. */ -void auth_user_pass_setup (const char *auth_file,bool is_inline, +void auth_user_pass_setup (const char *auth_file,bool is_inline,bool username_only,const struct static_challenge_info *sc_info);/*
src/openvpn/ssl_common.h +1 -0
@@ -396,6 +396,7 @@const char *export_peer_cert_dir;const char *auth_user_pass_file;bool auth_user_pass_file_inline; +bool auth_user_pass_username_only;bool auth_token_generate;/**< Generate auth-tokens on successful * user/pass auth,seet via
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I788f76e6a70a9c20bca3367140d2741bd0551582
Gerrit-Change-Number: 1548
Gerrit-PatchSet: 8
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email )
Change subject: Add an optional username-only flag for auth-user-pass
......................................................................
Add an optional username-only flag for auth-user-pass
Specify "--auth-user-pass username-only" for openvpn to prompt for only username, not password. Prompt via management interface uses the usual ">PASSWORD 'Auth' " prompt with type "username" instead of "username/password".
Internally, the password gets set as "[[BLANK]]" which is currently used as tag for blank password.
Not compatible with --static-challenge or when username and password are inlined or read from a file. In such cases, the user hard-code a dummy password in the file instead.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1548
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35855.html
---
M doc/man-sections/client-options.rst
M doc/management-notes.txt
M src/openvpn/init.c
M src/openvpn/manage.c
M src/openvpn/manage.h
M src/openvpn/misc.c
M src/openvpn/misc.h
M src/openvpn/options.c
M src/openvpn/options.h
M src/openvpn/ssl.c
M src/openvpn/ssl.h
M src/openvpn/ssl_common.h
12 files changed, 92 insertions(+), 15 deletions(-)
doc/man-sections/client-options.rst +17 -1
@@ -68,7 +68,9 @@ auth-user-pass up If ``up`` is present, it must be a file containing username/password on 2 - lines. If the password line is missing, OpenVPN will prompt for one. + lines or a flag named :code:`username-only` to indicate no password + should be prompted for. In the former case, if the password line is missing + in the file, OpenVPN will prompt for one. If ``up`` is omitted, username/password will be prompted from the console.
@@ -84,6 +86,20 @@ where password is optional, and will be prompted from the console if missing. + The :code:`username-only` flag is meant to be used with SSO authentication. + In this case the user will be asked for a username but not password. Instead, + a dummy password :code:`[[BLANK]]` is generated internally and submitted to + the server. See management-notes.txt for how this option affects username/password + prompt via the management interface. For the console, it simply eliminates + the password prompt. + + The :code:`username-only` flag cannot be used along with embedding username and/or + password in the config file, or while reading them from an external file. In + such cases, if only username is relevant and no password prompt is desired, a + dummy password like 'no_passsword' should be embedded as well. This flag is also + incompatible with the ``--static-challenge`` option and legacy ``dynamic challenge`` + protocol. + The server configuration must specify an ``--auth-user-pass-verify`` script to verify the username/password provided by the client.
doc/management-notes.txt +14 -0
@@ -304,6 +304,19 @@ username "Auth" foo password "Auth" bar + Example 3: + + >PASSWORD:Need 'Auth' username + + OpenVPN needs a --auth-user-pass username. The + management interface client should respond: + + username "Auth" foo + + In this case the user should not be prompted for a password. + Support for such username-only prompting is conditional on the + client announcing a version >= 4. + The username/password itself can be in quotes, and special characters such as double quote or backslash must be escaped, for example,
@@ -499,6 +512,7 @@ Minimum client version required for certain features is listed below: >PK_SIGN:[base64] -- version 2 or greater >PK_SIGN:[base64],[alg] -- version 3 or greater + >PASSWORD:Need 'Auth' username -- version 4 or greater COMMAND -- auth-retry ---------------------
src/openvpn/init.c +3 -2
@@ -665,10 +665,10 @@enable_auth_user_pass ();#ifdef ENABLE_MANAGEMENT auth_user_pass_setup (c->options.auth_user_pass_file, c->options.auth_user_pass_file_inline, - &c->options.sc_info); + c->options.auth_user_pass_username_only, &c->options.sc_info);#else auth_user_pass_setup (c->options.auth_user_pass_file, c->options.auth_user_pass_file_inline, -NULL ); + c->options.auth_user_pass_username_only,NULL );#endif } }
@@ -3386,6 +3386,7 @@ } to.auth_user_pass_file = options->auth_user_pass_file; to.auth_user_pass_file_inline = options->auth_user_pass_file_inline; + to.auth_user_pass_username_only = options->auth_user_pass_username_only; to.auth_token_generate = options->auth_token_generate; to.auth_token_lifetime = options->auth_token_lifetime; to.auth_token_renewal = options->auth_token_renewal;
src/openvpn/manage.c +17 -4
@@ -58,9 +58,6 @@#define MANAGEMENT_ECHO_FLAGS 0#endif -/* tag for blank username/password */ -static const char blank_up[] ="[[BLANK]]" ; -/* * Management client versions indicating feature support in client. * Append new values as needed but do not change exisiting ones.
@@ -70,6 +67,7 @@MCV_DEFAULT =1 ,MCV_PKSIGN =2 ,MCV_PKSIGN_ALG =3 , + MCV_USERNAME_ONLY = 4, };struct management *management;/* GLOBAL */
@@ -740,6 +738,13 @@ {switch (man->connection.up_query_mode) { +case UP_QUERY_USERNAME : +if (strlen (man->connection.up_query.username)) + { + man->connection.up_query.defined = true; + } +break ; +case UP_QUERY_USER_PASS :if (!strlen (man->connection.up_query.username)) {
@@ -794,7 +799,9 @@ man_query_username(struct management *man, const char *type, const char *string) { const bool needed = - ((man->connection.up_query_mode ==UP_QUERY_USER_PASS ) && man->connection.up_query_type); + ((man->connection.up_query_mode ==UP_QUERY_USER_PASS + || man->connection.up_query_mode ==UP_QUERY_USERNAME ) + && man->connection.up_query_type);man_query_user_pass (man, type, string, needed,"username" , man->connection.up_query.username,USER_PASS_LEN ); }
@@ -3558,6 +3565,12 @@ prefix ="PASSWORD" ; alert_type ="password" ; } +else if ((man->connection.client_version >=MCV_USERNAME_ONLY ) && (flags &GET_USER_PASS_USERNAME_ONLY )) + { + up_query_mode =UP_QUERY_USERNAME ; + prefix ="PASSWORD" ; + alert_type ="username" ; + }else { up_query_mode =UP_QUERY_USER_PASS ;
src/openvpn/manage.h +1 -0
@@ -264,6 +264,7 @@#define UP_QUERY_PASS 2#define UP_QUERY_NEED_OK 3#define UP_QUERY_NEED_STR 4 +#define UP_QUERY_USERNAME 5/* states */ #define MS_INITIAL 0/* all sockets are closed */
src/openvpn/misc.c +7 -2
@@ -215,7 +215,6 @@ {msg (M_WARN ,"Note: previous '%s' credentials failed" , prefix); } -#ifdef ENABLE_MANAGEMENT /* * Get username/password from management interface?
@@ -389,7 +388,7 @@query_user_add (BSTR (&user_prompt), up->username,USER_PASS_LEN , true); } -if (password_from_stdin) +if (password_from_stdin && !(flags &GET_USER_PASS_USERNAME_ONLY )) {query_user_add (BSTR (&pass_prompt), up->password,USER_PASS_LEN , false); }
@@ -451,6 +450,12 @@ } } +/* Use tag for blank password if we are not prompting for one */ +if (flags &GET_USER_PASS_USERNAME_ONLY ) + { +strncpy (up->password, blank_up,sizeof (up->password)); + } +string_mod (up->username,CC_PRINT ,CC_CRLF ,0 );string_mod (up->password,CC_PRINT ,CC_CRLF ,0 );
src/openvpn/misc.h +5 -0
@@ -48,6 +48,9 @@* Get and store a username/password */ +/* tag for blank username/password */ +static const char blank_up[] ="[[BLANK]]" ; +struct user_pass {bool defined;
@@ -123,6 +126,8 @@#define GET_USER_PASS_INLINE_CREDS (1 << 10)/** indicates password and response should be concatenated */ #define GET_USER_PASS_STATIC_CHALLENGE_CONCAT (1 << 11) +/** indicate that only username should be prompted for auth-user-pass */ +#define GET_USER_PASS_USERNAME_ONLY (1 << 12)/** * Retrieves the user credentials from various sources depending on the flags.
src/openvpn/options.c +15 -2
@@ -510,7 +510,8 @@" up is a file containing the username on the first line,\n" " and a password on the second. If either the password or both\n" " the username and the password are omitted OpenVPN will prompt\n" -" for them from console.\n" +" for them from console. If [up] is 'username-only', only username\n" +" will be prompted for from console or management interface.\n" "--pull : Accept certain config file options from the peer as if they\n" " were part of the local config file. Must be specified\n" " when connecting to a '--mode server' remote host.\n"
@@ -3926,6 +3927,12 @@ { o->auth_token_renewal = o->renegotiate_seconds; } +#if ENABLE_MANAGEMENT +if (o->auth_user_pass_username_only && o->sc_info.challenge_text) + { +msg (M_USAGE ,"'auth-user-pass username-only' cannot be used with static challenge" ); + } +#endif pre_connect_save (o); }
@@ -7736,7 +7743,13 @@else if (streq (p[0 ],"auth-user-pass" ) && !p[2 ]) {VERIFY_PERMISSION (OPT_P_GENERAL |OPT_P_INLINE ); -if (p[1 ]) + options->auth_user_pass_username_only = false; +if (p[1 ] &&streq (p[1 ],"username-only" )) + { + options->auth_user_pass_username_only = true; + options->auth_user_pass_file ="stdin" ; + } +else if (p[1 ]) { options->auth_user_pass_file = p[1 ]; options->auth_user_pass_file_inline = is_inline;
src/openvpn/options.h +1 -0
@@ -557,6 +557,7 @@uint64_t push_update_options_found;/* tracks which option types have been reset in current PUSH_UPDATE sequence */ const char *auth_user_pass_file;bool auth_user_pass_file_inline; +bool auth_user_pass_username_only;struct options_pre_connect *pre_connect;int scheduled_exit_interval;
src/openvpn/ssl.c +10 -3
@@ -290,7 +290,8 @@ }void -auth_user_pass_setup (const char *auth_file,bool is_inline,const struct static_challenge_info *sci) +auth_user_pass_setup (const char *auth_file,bool is_inline,bool username_only, +const struct static_challenge_info *sci) {unsigned int flags =GET_USER_PASS_MANAGEMENT ;
@@ -298,6 +299,10 @@ { flags |=GET_USER_PASS_INLINE_CREDS ; } +if (username_only) + { + flags |=GET_USER_PASS_USERNAME_ONLY ; + }if (!auth_user_pass.defined && !auth_token.defined) {
@@ -2099,10 +2104,12 @@ {#ifdef ENABLE_MANAGEMENT auth_user_pass_setup (session->opt->auth_user_pass_file, - session->opt->auth_user_pass_file_inline, session->opt->sci); + session->opt->auth_user_pass_file_inline, + session->opt->auth_user_pass_username_only, session->opt->sci);#else auth_user_pass_setup (session->opt->auth_user_pass_file, - session->opt->auth_user_pass_file_inline,NULL ); + session->opt->auth_user_pass_file_inline, + session->opt->auth_user_pass_username_only,NULL );#endif struct user_pass *up = &auth_user_pass;
src/openvpn/ssl.h +1 -1
@@ -389,7 +389,7 @@* credentials stored in the file, however, if is_inline is true then auth_file * contains the username/password inline. */ -void auth_user_pass_setup (const char *auth_file,bool is_inline, +void auth_user_pass_setup (const char *auth_file,bool is_inline,bool username_only,const struct static_challenge_info *sc_info);/*
src/openvpn/ssl_common.h +1 -0
@@ -396,6 +396,7 @@const char *export_peer_cert_dir;const char *auth_user_pass_file;bool auth_user_pass_file_inline; +bool auth_user_pass_username_only;bool auth_token_generate;/**< Generate auth-tokens on successful * user/pass auth,seet via
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I788f76e6a70a9c20bca3367140d2741bd0551582
Gerrit-Change-Number: 1548
Gerrit-PatchSet: 8
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>